Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# - A type parameter is missing a constraint when 'k : comparison

I have this line of code which gives the error stated in the subject line:

type trie<'k,'a> = TNode of ('a option * Map<'k,('k,'a) trie>)

I've tried inserting "when k : comparison" every possible way I can think of to no avail. I can only find examples of this using one generic parameter and not two.

Thanks in advance,

Bob

like image 279
Beaker Avatar asked Jun 26 '11 00:06

Beaker


1 Answers

Try this:

type trie<'k,'a when 'k : comparison> = TNode of ('a option * Map<'k,trie<'k,'a>>)
like image 153
kvb Avatar answered Nov 10 '22 00:11

kvb