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.119 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.118 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.117 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.116 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.115 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.114 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.113 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.111 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.110 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.109 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.108 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.107 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.106 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.105 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.104 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.103 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.102 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.101 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.100 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.99 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml