While reading the source code of F #, give me the list & lt; 'T & gt; Type found
which looks like this:
type list & lt; 'T & gt; = | ([]): 'T list | (: :): Head: 't * Tale:' t list - & gt; 'T list
Anyone, please, can explain the syntax above? The compiler warns that 'this building is disliked: it is only for use in the F # library', is the syntax of defining contradictory unions just an old way? If so, why is the type of tail
't list - & gt; Instead of
't list
' t list
my Believe it what it means:
type list & lt; 'T & gt; = | ([]): 'T list | (: :): (Head: 't * tail:' t list) - & gt; To say that, (: :)
is a function, which is a ordered pair 'T *' T list
Code> creates a 't list'
The excluded construction is giving type annotation to the discriminated union constructor. You do not have to do that, any version of F # In, as far as I know. I do not know why he had to do this in the F. Library?
No comments:
Post a Comment