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.180 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.179 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.178 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.177 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.176 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.175 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.174 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.173 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.172 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.171 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.170 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.169 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.167 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.166 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.165 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.164 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.163 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.162 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.161 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.160 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml