Skip to content
CCPEDIAby Unity Nodes
Outreach

Template Ord

2 posts363 views5 likesLast activity Oct 2021

  1. filOP 1

    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
    
  2. cocreature 4

    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