language-ats 0.1.1.7 → 0.1.1.8
raw patch · 5 files changed
+88/−2 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- language-ats.cabal +1/−1
- src/Language/ATS/Parser.y +2/−0
- src/Language/ATS/Types.hs +1/−1
- test/data/dhall-ats.dats +42/−0
- test/data/dhall-ats.out +42/−0
language-ats.cabal view
@@ -1,5 +1,5 @@ name: language-ats-version: 0.1.1.7+version: 0.1.1.8 synopsis: Parser and pretty-printer for ATS. description: Parser and pretty-printer for [ATS](http://www.ats-lang.org/), written with Happy and Alex. license: BSD3
src/Language/ATS/Parser.y view
@@ -461,6 +461,8 @@ | Implicits lspecial TypeIn rbracket { $3 : $1 } | doubleBrackets { [[Named (Unqualified "")]] } | Implicits doubleBrackets { [Named (Unqualified "")] : $1 }+ | lbracket TypeIn rbracket { [$2] }+ | Implicits lspecial TypeIn rbracket { $3 : $1 } MaybeImplicit : Implicits { $1 } | { [] }
src/Language/ATS/Types.hs view
@@ -287,7 +287,7 @@ | ProofExpr AlexPosn Expression Expression | TypeSignature Expression Type | WhereExp Expression [Declaration]- | TupleEx AlexPosn [Expression]+ | TupleEx AlexPosn [Expression] -- TODO support boxed tuples | While AlexPosn Expression Expression | Actions ATS | Begin AlexPosn Expression
+ test/data/dhall-ats.dats view
@@ -0,0 +1,42 @@+#include ".atspkg/contrib/hs-bind-0.3.6/runtime.dats"+#include "share/atspre_staload.hats"++staload UN = "prelude/SATS/unsafe.sats"+staload "src/gen.sats"++fun free_option(x : option(int)) : void =+ case+ x of+ | ~Some (_) => ()+ | ~None() => ()++fun print_pair(x : pair(int, int)) : void =+ let+ val f = x.first+ val s = x.second+ in+ println!("Pair { first = ", f, ", second = ", s, " }")+ end++fun print_option_int(x : !option(int)) : void =+ case+ x of+ | Some (n) => (print("Some") ; println!(n))+ | None() => println!("None")++extern+fun hs_pass() : ptr =+ "mac#pass_val"++extern+fun hs_read() : ptr =+ "mac#read_dhall"++implement main0 (argc, argv) =+ {+ val _ = hs_init(argc, argv)+ var x = $UN.ptr0_get<option(int)>(hs_read())+ val y = $UN.ptr0_get<pair(int, int)>(hs_pass())+ val _ = print_pair(y)+ val _ = print_option_int(x)+ val _ = free_option(x)+ val _ = hs_exit()+ }
+ test/data/dhall-ats.out view
@@ -0,0 +1,42 @@+#include ".atspkg/contrib/hs-bind-0.3.6/runtime.dats"+#include "share/atspre_staload.hats"++staload UN = "prelude/SATS/unsafe.sats"+staload "src/gen.sats"++fun free_option(x : option(int)) : void =+ case+ x of+ | ~Some (_) => ()+ | ~None() => ()++fun print_pair(x : pair(int, int)) : void =+ let+ val f = x.first+ val s = x.second+ in+ println!("Pair { first = ", f, ", second = ", s, " }")+ end++fun print_option_int(x : !option(int)) : void =+ case+ x of+ | Some (n) => (print("Some") ; println!(n))+ | None() => println!("None")++extern+fun hs_pass() : ptr =+ "mac#pass_val"++extern+fun hs_read() : ptr =+ "mac#read_dhall"++implement main0 (argc, argv) =+ {+ val _ = hs_init(argc, argv)+ var x = $UN.ptr0_get<option(int)>(hs_read())+ val y = $UN.ptr0_get<pair(int, int)>(hs_pass())+ val _ = print_pair(y)+ val _ = print_option_int(x)+ val _ = free_option(x)+ val _ = hs_exit()+ }