Thank you for the replies to my first post and my second post on this project. This question is basically the same question as the first, but with my code updated according to t
My first answer was completely wrong, but I'd thought I'd leave it up.
The types Post
and Content
are defined as:
type Content =
| Content of string
| Post of Post list
and Post =
{ headers : Header list
; content : Content }
Post
is a Record, and Content
is a Discriminated Union.
F# treats the cases for Discriminated Unions as a separate namespace from types. So Content
is different from Content.Content
, and Post
is different from Content.Post
. Because they are different, having the same identifier is confusing.
What is pContent
supposed to be returning? If it's supposed to be returning the Discriminated Union Content
, you need to wrap the Post
record you are returning in the first case in the Content.Post
case i.e.
$ fun h c -> Post [ { headers=h
; content=Content $ unlines c } ]
(F# is able to infer that 'Post' refers to Content.Post
case, instead of the Post
record type here.)