Giter Club home page Giter Club logo

stt's People

Contributors

tchou avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

stt's Issues

Assertion error for a certain type

Parsing the type

type t1 = [ (X, Y) ] 
    where X = [ Int; Y* ] 
    and Y = X | `nil

type t2 = [ X; X ] 
    where X = [ t1*; Y ]
    and Y = X | [ Z*; Bool ] | `nil
    and Z = Int | X | `nil

gives the error

Fatal error: exception File "core/typ.ml", line 244, characters 2-8: Assertion failed

which is, for me, in the function

let descr n =
  assert (n.id >= 0);
  n.descr

A huuuge type

Parsing the type

type t ('a, 'b) = [ X*; Y; X ] 
    where X = 'a | (Y & Z) 
    and Y = ('a, 'b) | `nil 
    and Z = [ 'a; 'b; X* ]

generates a very huge type when applying a substitution in order to compare it to its pretty-printed type (re-parsed)
This is the function doing the variable subsitution in order to do the comparison

open Stt

let alpha_renaming (t : Typ.t)
                   (t' : Typ.t) =
    let vp, vn = Typ.vars t in
    let v = Var.Set.union vp vn in
    let var_map = Var.Set.fold (
      fun v acc -> (v.Var.name, v) :: acc
    ) v []
    in
    let vp', vn' = Typ.vars t' in
    let v' = Var.Set.union vp' vn' in
    let subst = Var.Set.fold (
      fun v acc ->
        let n_var =
          match List.assoc_opt v.Var.name var_map with
          | Some n_var -> n_var
          | None -> v
        in
        Subst.add v (Typ.var n_var) acc
    ) v' @@ Subst.of_list []
    in
    Subst.apply subst t'

It takes a lot of time while during

Stt.Typ.equiv t t'

where t is the original type, and t' the pretty-printed type

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.