overloaded-0.1: Overloaded pragmas as a plugin

Safe HaskellNone
LanguageHaskell2010

Overloaded.Lists

Description

Another way to desugar overloaded numeric literals. See FromNatural.

An explicit list expression, e.g. [1, True] is desugared to

cons 1 (cons True nil)

Enabled with:

{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Lists #-}
Synopsis
  • class Nil a where
  • class Cons x ys zs | zs -> x ys where
    • cons :: x -> ys -> zs

Documentation

class Nil a where Source #

Class for nil, []

See test-suite for ways to define instances for Map. There are at-least two-ways.

Methods

nil :: a Source #

Instances
Nil [a] Source # 
Instance details

Defined in Overloaded.Lists

Methods

nil :: [a] Source #

n ~ Z => Nil (Vec n a) Source # 
Instance details

Defined in Overloaded.Lists

Methods

nil :: Vec n a Source #

xs ~ ([] :: [Type]) => Nil (NP f xs) Source # 
Instance details

Defined in Overloaded.Lists

Methods

nil :: NP f xs Source #

xs ~ ([] :: [[Type]]) => Nil (POP f xs) Source # 
Instance details

Defined in Overloaded.Lists

Methods

nil :: POP f xs Source #

class Cons x ys zs | zs -> x ys where Source #

Class for Cons :.

Methods

cons :: x -> ys -> zs Source #

Instances
Cons a [a] (NonEmpty a) Source # 
Instance details

Defined in Overloaded.Lists

Methods

cons :: a -> [a] -> NonEmpty a Source #

Cons a [a] [a] Source # 
Instance details

Defined in Overloaded.Lists

Methods

cons :: a -> [a] -> [a] Source #

Cons a (Vec n a) (Vec (S n) a) Source # 
Instance details

Defined in Overloaded.Lists

Methods

cons :: a -> Vec n a -> Vec (S n) a Source #

Cons (f x) (NP f xs) (NP f (x ': xs)) Source # 
Instance details

Defined in Overloaded.Lists

Methods

cons :: f x -> NP f xs -> NP f (x ': xs) Source #

Cons (NP f xs) (POP f xss) (POP f (xs ': xss)) Source # 
Instance details

Defined in Overloaded.Lists

Methods

cons :: NP f xs -> POP f xss -> POP f (xs ': xss) Source #