F# recursive bind with "and" gives "null", doesn't work

89 Views Asked by At

This is a brief example from the book, by Tomas Petricek, "Functional programming in the real world", chapter 8.

type QueryInfo = 
    {   Title: string
        Check: Client -> bool
        Positive: Decision
        Negative: Decision
    }
and Decision = 
    | Result of string
    | Query of QueryInfo
let rec tree1 = 
    Query({Title=null;Check=(fun cl -> false);Positive=aaa; Negative=aaa})
and aaa = Result("SOME")


The problem is - when I use tree1, its .Positive and .Negative are nulls. The same if aaa is Query, not Result. How to fix it?

0

There are 0 best solutions below

Related Questions in F#