package catala
Compiler and library for the literate programming language for tax code specification
Install
Dune Dependency
Authors
Maintainers
Sources
0.9.0.tar.gz
md5=8f891209d18b6540df9c34b2d1a6a783
sha512=737770b87a057674bceefe77e8526720732552f51f424afcebcb6a628267eab522c4fd993caca1ae8ed7ace65a4a87e485af10c1676e51ca5939509a1b841ac2
doc/src/catala.shared_ast/type.ml.html
Source file type.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 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 91 92 93 94 95 96
(* This file is part of the Catala compiler, a specification language for tax and social benefits computation rules. Copyright (C) 2020 Inria, contributor: Louis Gesbert <louis.gesbert@inria.fr> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) open Catala_utils open Definitions type t = typ let equal_tlit l1 l2 = l1 = l2 let compare_tlit l1 l2 = Stdlib.compare l1 l2 let rec equal ty1 ty2 = match Mark.remove ty1, Mark.remove ty2 with | TLit l1, TLit l2 -> equal_tlit l1 l2 | TTuple tys1, TTuple tys2 -> equal_list tys1 tys2 | TStruct n1, TStruct n2 -> StructName.equal n1 n2 | TEnum n1, TEnum n2 -> EnumName.equal n1 n2 | TOption t1, TOption t2 -> equal t1 t2 | TArrow (t1, t1'), TArrow (t2, t2') -> equal_list t1 t2 && equal t1' t2' | TArray t1, TArray t2 -> equal t1 t2 | TDefault t1, TDefault t2 -> equal t1 t2 | TClosureEnv, TClosureEnv | TAny, TAny -> true | ( ( TLit _ | TTuple _ | TStruct _ | TEnum _ | TOption _ | TArrow _ | TArray _ | TDefault _ | TAny | TClosureEnv ), _ ) -> false and equal_list tys1 tys2 = try List.for_all2 equal tys1 tys2 with Invalid_argument _ -> false (* Similar to [equal], but allows TAny holes *) let rec unifiable ty1 ty2 = match Mark.remove ty1, Mark.remove ty2 with | TAny, _ | _, TAny -> true | TLit l1, TLit l2 -> equal_tlit l1 l2 | TTuple tys1, TTuple tys2 -> unifiable_list tys1 tys2 | TStruct n1, TStruct n2 -> StructName.equal n1 n2 | TEnum n1, TEnum n2 -> EnumName.equal n1 n2 | TOption t1, TOption t2 -> unifiable t1 t2 | TArrow (t1, t1'), TArrow (t2, t2') -> unifiable_list t1 t2 && unifiable t1' t2' | TArray t1, TArray t2 -> unifiable t1 t2 | TDefault t1, TDefault t2 -> unifiable t1 t2 | TClosureEnv, TClosureEnv -> true | ( ( TLit _ | TTuple _ | TStruct _ | TEnum _ | TOption _ | TArrow _ | TArray _ | TDefault _ | TClosureEnv ), _ ) -> false and unifiable_list tys1 tys2 = try List.for_all2 unifiable tys1 tys2 with Invalid_argument _ -> false let rec compare ty1 ty2 = match Mark.remove ty1, Mark.remove ty2 with | TLit l1, TLit l2 -> compare_tlit l1 l2 | TTuple tys1, TTuple tys2 -> List.compare compare tys1 tys2 | TStruct n1, TStruct n2 -> StructName.compare n1 n2 | TEnum en1, TEnum en2 -> EnumName.compare en1 en2 | TOption t1, TOption t2 -> compare t1 t2 | TArrow (a1, b1), TArrow (a2, b2) -> ( match List.compare compare a1 a2 with 0 -> compare b1 b2 | n -> n) | TArray t1, TArray t2 -> compare t1 t2 | TAny, TAny | TClosureEnv, TClosureEnv -> 0 | TLit _, _ -> -1 | _, TLit _ -> 1 | TTuple _, _ -> -1 | _, TTuple _ -> 1 | TStruct _, _ -> -1 | _, TStruct _ -> 1 | TEnum _, _ -> -1 | _, TEnum _ -> 1 | TOption _, _ -> -1 | _, TOption _ -> 1 | TArrow _, _ -> -1 | _, TArrow _ -> 1 | TArray _, _ -> -1 | _, TArray _ -> 1 | TDefault _, _ -> -1 | _, TDefault _ -> 1 | TClosureEnv, _ -> -1 | _, TClosureEnv -> 1 let rec arrow_return = function TArrow (_, b), _ -> arrow_return b | t -> t
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>