Closed haf closed 9 years ago
How do I read a collection of a known type?
type Folder = { _url : Uri option email : string files : File list folders : Folder list id : string name : string } static member FromJson (_ : Folder) = (fun url email files folders id name -> { _url = Some (Uri url) email = email files = files folders = folders id = id name = name }) <!> Json.read "@url" <*> Json.read "Email" <*> Json.read "Files" // error: no overloads match... <*> Json.read "Folders" <*> Json.read "Id" <*> Json.read "Name"
I'm trying to read a File and a Folder list; File already has ToJson and FromJson.
ToJson
FromJson
Came from bad FromJson on File. Remember, children, to check your function signatures especially when using Damas-Hindley-Milner type inference.
File
How do I read a collection of a known type?
I'm trying to read a File and a Folder list; File already has
ToJson
andFromJson
.