Sha256: c53c7c3248e8e2e5467c73f81833129405d1f676d08ec6d97938cb58f3f4b345

Contents?: true

Size: 821 Bytes

Versions: 159

Compression:

Stored size: 821 Bytes

Contents

open Core

open Model
open Yojson.Basic

let map_elements (to_str: json -> string) (parameters: (string * json) list): (string * string) list =
  List.map parameters ~f:(fun (k,j) -> (k,to_str j))

let optional_int ~(none: int) = function
| `Int n when n = none -> "Nothing"
| `Int n -> "(Just " ^ Int.to_string n ^ ")"
| x -> json_to_string x

let rec edit_expected ~(f: json -> string) (parameters: (string * json) list) = match parameters with
| [] -> []
| ("expected", v) :: rest -> ("expected", f v) :: edit_expected f rest
| (k, v) :: rest -> (k, json_to_string v) :: edit_expected f rest

let purescript_edit_parameters ~(slug: string) (parameters: (string * json) list) = match (slug, parameters) with
| ("hamming", ps) -> edit_expected ~f:(optional_int ~none:(-1)) ps
| (_, ps) -> map_elements json_to_string ps

Version data entries

159 entries across 159 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.138 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.137 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.136 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.135 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.134 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.133 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.132 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.131 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.130 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.129 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.128 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.127 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.126 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.125 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.124 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.123 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.122 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.121 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.120 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml