units-2.4.1: A domain-specific type system for dimensional analysis

Copyright(C) 2013 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (rae@cs.brynmawr.edu)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Metrology.Set

Description

This module defines a few set-like operations on type-level lists. It may be applicable beyond the units package.

Synopsis

Documentation

type family SetEqual (as :: [k]) (bs :: [k]) :: Constraint where ... Source #

Are two lists equal, when considered as sets?

Equations

SetEqual as bs = (Subset as bs, Subset bs as) 

type family Subset (as :: [k]) (bs :: [k]) :: Constraint where ... Source #

Is one list a subset of the other?

Equations

Subset '[] bs = (() :: Constraint) 
Subset (a ': as) bs = (a `Elem` bs, as `Subset` bs) 

type family Elem (a :: k) (bs :: [k]) :: Constraint where ... Source #

Is an element contained in a list?

Equations

Elem a (a ': bs) = (() :: Constraint) 
Elem a (b ': bs) = a `Elem` bs