-
Notifications
You must be signed in to change notification settings - Fork 827
Open
Labels
Area-Compiler-Syntaxlexfilter, indentation and parsinglexfilter, indentation and parsingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
In this snippet,
type Digit<'a> = 'a list
type FingerTree<'a> =
| Empty
| Single of 'a
| Deep of Digit<'a> * FingerTree<Node<'a>> * Digit<'a>
let rec (<<)<'a> (a: 'a) (tree: FingerTree<'a>): FingerTree<'a> =
match tree with
| Empty -> Single a
| Single b -> Deep ([a], Empty, [b])
| Deep ([b; c; d; e], m, suffix) -> Deep ([a; b], (Node3 (c, d, e)) << m, suffix)
| Deep (prefix, m, suffix) -> Deep (List.append [a] prefix, m, suffix)
the compiler warns that "Type parameters must be placed directly adjacent to the type name". Presumably that's because the method name is surrounded by ()s.
(I need the <'a>
because the function takes a FingerTree<'a> but the recursion takes a FingerTree<Node<'a>>.)
If I make the operator a function, instead --
let rec addToFront<'a> (a: 'a) (tree: FingerTree<'a>): FingerTree<'a> =
match tree with
| Empty -> Single a
| Single b -> Deep ([a], Empty, [b])
| Deep ([b; c; d; e], m, suffix) -> Deep ([a; b], addToFront (Node3 (c, d, e)) m, suffix)
| Deep (prefix, m, suffix) -> Deep (List.append [a] prefix, m, suffix)
-- then everything works.
Metadata
Metadata
Assignees
Labels
Area-Compiler-Syntaxlexfilter, indentation and parsinglexfilter, indentation and parsingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
In Progress