Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noti0na1/gadtformat
Type-safe Format using GADT in OCaml
https://github.com/noti0na1/gadtformat
format gadt ocaml
Last synced: 3 months ago
JSON representation
Type-safe Format using GADT in OCaml
- Host: GitHub
- URL: https://github.com/noti0na1/gadtformat
- Owner: noti0na1
- License: mit
- Created: 2018-06-04T23:45:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T03:23:10.000Z (over 6 years ago)
- Last Synced: 2023-12-22T16:10:32.649Z (about 1 year ago)
- Topics: format, gadt, ocaml
- Language: OCaml
- Size: 3.91 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GADTFormat
Type-safe Format using GADT in OCaml
## Example
```ocaml
open GADTFormat(* "Digit: %d%s" *)
let fs0 r = lit "Digit: " @@ dig @@ str r(* fs1 : int -> string -> string *)
let fs1 = sprintf @@ to_str fs0(*
append format string:
"Digit: %d%s, Digit: %d%s"
*)
let fs2 r = fs0 @@ lit ", " @@ fs0 r(* fs3 : int -> string -> int -> string -> string *)
let fs3 = printf @@ to_out fs2let _ =
print_endline @@ fs1 3 "c";
fs3 1 "a" 2 "b\n"
```## Licence
Distributed under the terms of [MIT License](LICENSE)
Copyright (c) 2018 noti0na1