-
-
Save j0sh/d16e9351c00266106c3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| File "t.ml", line 14, characters 6-16: | |
| Error: This pattern matches values of type param t | |
| but a pattern was expected which matches values of type literal t | |
| Type param is not compatible with type literal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type literal | |
| type param | |
| type _ t = | |
| | QueryString : string -> literal t | |
| | IntParam : string -> param t | |
| | StringParam : string -> param t | |
| type 'a query = 'a t list | |
| let to_string (q:'a query) : string = | |
| let t2s (r:'a t) : string = match r with | |
| | QueryString s -> s | |
| | IntParam s | StringParam s -> ":" ^ s in | |
| let strs = List.map t2s q in | |
| String.concat "" strs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment