Skip to content
CCPEDIAby Unity Nodes
Discussions/Outreach/Template OrdForum ↗

Template Ord

Outreach2 posts338 views5 likesLast activity Oct 2021
FI
filOP
Oct 2021

How do I make the data-type created by a template (not the template itself) implement Ord?

eg.:


let a: [A] = ...
let x = L.sort a
CO
cocreature
Oct 2021

Templates derive Eq and Show by default. The template syntax does not allow you to use the regular deriving clauses but you can use a feature called “standalone deriving” to derive an Ord instance for your template A:

deriving instance Ord a
← Back to Discussions