-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Overloaded pragmas as a plugin -- -- Implement Overloaded pragmas as a source plugin -- -- For example we can replace -- --
--   {-# LANGUAGE OverloadedStrings #-}
--   
-- -- with -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Strings #-}
--   
@package overloaded @version 0.1.2 -- | Overloaded characters. module Overloaded.Chars -- | Class for Char-like datastructures -- -- A character literal x is desugared to -- --
--   fromChar 'x'
--   
class FromChar a fromChar :: FromChar a => Char -> a instance Overloaded.Chars.FromChar GHC.Types.Char -- | Overloaded if-expression. module Overloaded.If -- | Class for Bool-like datastrucutres -- -- An if--expression if b then t else e is desugared to -- --
--   ifte (toBool b) t e
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:If #-}
--   
class ToBool b toBool :: ToBool b => b -> Bool -- | ToBool overloaded if-expression. ifte :: ToBool b => b -> a -> a -> a instance Overloaded.If.ToBool GHC.Types.Bool instance Overloaded.If.ToBool (GHC.Maybe.Maybe a) instance Overloaded.If.ToBool (Data.Either.Either b a) -- | 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 #-}
--   
module Overloaded.Lists -- | Class for nil, [] -- -- See test-suite for ways to define instances for Map. There are -- at-least two-ways. class Nil a nil :: Nil a => a -- | Class for Cons :. class Cons x ys zs | zs -> x ys cons :: Cons x ys zs => x -> ys -> zs instance Overloaded.Lists.Cons a [a] [a] instance Overloaded.Lists.Cons a [a] (GHC.Base.NonEmpty a) instance Overloaded.Lists.Cons a (Data.Vec.Lazy.Vec n a) (Data.Vec.Lazy.Vec ('Data.Nat.S n) a) instance Overloaded.Lists.Cons (f x) (Data.SOP.NP.NP f xs) (Data.SOP.NP.NP f (x : xs)) instance Overloaded.Lists.Cons (Data.SOP.NP.NP f xs) (Data.SOP.NP.POP f xss) (Data.SOP.NP.POP f (xs : xss)) instance Overloaded.Lists.Nil [a] instance (n Data.Type.Equality.~ 'Data.Nat.Z) => Overloaded.Lists.Nil (Data.Vec.Lazy.Vec n a) instance (xs Data.Type.Equality.~ '[]) => Overloaded.Lists.Nil (Data.SOP.NP.NP f xs) instance (xs Data.Type.Equality.~ '[]) => Overloaded.Lists.Nil (Data.SOP.NP.POP f xs) -- | Overloaded natural numbers. module Overloaded.Naturals -- | Class for Natural-like datastructures -- -- A numeric literal 42 is desugared to -- --
--   fromNatural 42
--   
class FromNatural a fromNatural :: FromNatural a => Natural -> a instance Overloaded.Naturals.FromNatural GHC.Natural.Natural instance Overloaded.Naturals.FromNatural GHC.Integer.Type.Integer -- | Another way to desugar overloaded numeric literals. See -- FromNumeral. module Overloaded.Numerals -- | Another way to desugar numerals. -- -- A numeric literal 123 is desugared to -- --
--   fromNumeral @123
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Numerals #-}
--   
-- -- One can do type-level computations with this. class FromNumeral (n :: Nat) a fromNumeral :: FromNumeral n a => a -- | Default implementation of fromNumeral. -- -- Usage example: -- --
--   instance (KnownNat n, ...) => FromNumeral n MyType where
--       fromNumeral = defaultFromNumeral @n
--   
defaultFromNumeral :: forall n a. (KnownNat n, Integral a) => a instance Overloaded.Numerals.FinFromNumeral 'Data.Nat.Z ('Data.Nat.S m) instance Overloaded.Numerals.FinFromNumeral n m => Overloaded.Numerals.FinFromNumeral ('Data.Nat.S n) ('Data.Nat.S m) instance (Overloaded.Numerals.FinFromNumeral (Data.Type.Nat.FromGHC n) m, Overloaded.Numerals.IsLess (Data.Type.Nat.FromGHC n) m n (Data.Type.Nat.ToGHC m)) => Overloaded.Numerals.FromNumeral n (Data.Fin.Fin m) instance (GHC.TypeNats.KnownNat n, Overloaded.Numerals.OverflowCheck n "Word8" (n GHC.TypeNats.<=? 255)) => Overloaded.Numerals.FromNumeral n GHC.Word.Word8 instance (GHC.TypeNats.KnownNat n, Overloaded.Numerals.OverflowCheck n "Word8" (n GHC.TypeNats.<=? 65535)) => Overloaded.Numerals.FromNumeral n GHC.Word.Word16 instance (GHC.TypeNats.KnownNat n, Overloaded.Numerals.OverflowCheck n "Word8" (n GHC.TypeNats.<=? 4294967295)) => Overloaded.Numerals.FromNumeral n GHC.Word.Word32 instance (GHC.TypeNats.KnownNat n, Overloaded.Numerals.OverflowCheck n "Word8" (n GHC.TypeNats.<=? 18446744073709551615)) => Overloaded.Numerals.FromNumeral n GHC.Word.Word64 instance GHC.TypeNats.KnownNat n => Overloaded.Numerals.FromNumeral n GHC.Natural.Natural instance GHC.TypeNats.KnownNat n => Overloaded.Numerals.FromNumeral n GHC.Integer.Type.Integer instance GHC.TypeNats.KnownNat n => Overloaded.Numerals.FromNumeral n GHC.Types.Int instance GHC.TypeNats.KnownNat n => Overloaded.Numerals.FromNumeral n Data.Nat.Nat -- | Overloaded plugin, which makes magic possible. module Overloaded.Plugin -- | Overloaded plugin. -- -- To enable plugin put the following at top of the module: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-}
--   
-- -- At least one option is required, multiple can given either using -- multiple -fplugin-opt options, or by separating options with -- colon: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols:Numerals #-}
--   
-- -- Options also take optional desugaring names, for example -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Labels=Data.Generics.ProductFields.field #-}
--   
-- -- to desugar OverloadedLabels directly into field from -- generics-lens (no need to import orphan instance!) -- --

Supported options

-- -- -- --

Known limitations

-- -- -- --

RecordFields

-- -- WARNING the type-checker plugin is experimental, it's adviced -- to use -- --
--   {-# OPTIONS_GHC -ddump-simpl #-}
--   
-- -- to avoid surprising segfaults. -- --

Usage

-- -- {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:RecordFields -- #-} -- --

Implementation bits

-- -- See Note [HasField instances] in ClsInst, the behavior of this -- plugin is similar. -- -- The HasField class is defined in GHC.Records.Compat -- module of record-hasfield package: -- --
--   class HasField {k} x r a | x r -> a where
--       hasField :: r -> (a -> r, a)
--   
-- -- Suppose we have -- --
--   data R y = MkR { foo :: [y] }
--   
-- -- and foo in scope. We will solve constraints like -- --
--   HasField "foo" (R Int) a
--   
-- -- by emitting a new wanted constraint -- --
--   [Int] ~# a
--   
-- -- and building a HasField dictionary out of selector -- foo appropriately cast. -- --

Idiom brackets from TemplateHaskellQuotes

-- --
--   {-# LANGUAGE TemplateHaskellQuotes #-}
--   {-# OPTIONS_GHC -fplugin=Overloaded -fplugin-opt=Overloaded:IdiomBrackets #-}
--   
--   data Tree a
--       = Leaf a
--       | Branch (Tree a) (Tree a)
--     deriving (Show)
--   
--   instance Functor Tree where
--       fmap f (Leaf x)     = Leaf (f x)
--       fmap f (Branch l r) = Branch (fmap f l) (fmap f r)
--   
--   instance Traversable Tree where
--       traverse f (Leaf x)     = [| Leaf (f x) |]
--       traverse f (Branch l r) = [| Branch (traverse f l) (traverse f r) |]
--   
plugin :: Plugin instance GHC.Show.Show a => GHC.Show.Show (Overloaded.Plugin.V4 a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Overloaded.Plugin.V4 a) instance GHC.Show.Show Overloaded.Plugin.Options instance GHC.Classes.Eq Overloaded.Plugin.Options instance GHC.Show.Show a => GHC.Show.Show (Overloaded.Plugin.V2 a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Overloaded.Plugin.V2 a) instance GHC.Show.Show Overloaded.Plugin.StrSym instance GHC.Classes.Eq Overloaded.Plugin.StrSym instance GHC.Show.Show Overloaded.Plugin.NumNat instance GHC.Classes.Eq Overloaded.Plugin.NumNat instance GHC.Show.Show Overloaded.Plugin.VarName instance GHC.Classes.Eq Overloaded.Plugin.VarName instance GHC.Show.Show a => GHC.Show.Show (Overloaded.Plugin.OnOff a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Overloaded.Plugin.OnOff a) -- | Another way to desugar overloaded string literals. See -- FromSymbol. module Overloaded.Symbols -- | Another way to desugar overloaded string literals using this class. -- -- A string literal "example" is desugared to -- --
--   fromSymbol @"example"
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-}
--   
class FromSymbol (s :: Symbol) a fromSymbol :: FromSymbol s a => a instance (GHC.TypeNats.KnownNat y, GHC.TypeNats.KnownNat m, GHC.TypeNats.KnownNat d, Overloaded.Symbols.ParseDay s Data.Type.Equality.~ '(y, m, d)) => Overloaded.Symbols.FromSymbol s Data.Time.Calendar.Days.Day instance (GHC.TypeLits.KnownSymbol s, Overloaded.Symbols.SeqList (Data.Symbol.Ascii.Internal.ToList s)) => Overloaded.Symbols.FromSymbol s Data.ByteString.Internal.ByteString instance (GHC.TypeLits.KnownSymbol s, Overloaded.Symbols.SeqList (Data.Symbol.Ascii.Internal.ToList s)) => Overloaded.Symbols.FromSymbol s Data.ByteString.Lazy.Internal.ByteString instance (GHC.TypeLits.KnownSymbol s, a Data.Type.Equality.~ GHC.Types.Char) => Overloaded.Symbols.FromSymbol s [a] instance GHC.TypeLits.KnownSymbol s => Overloaded.Symbols.FromSymbol s Data.Text.Internal.Text instance GHC.TypeLits.KnownSymbol s => Overloaded.Symbols.FromSymbol s Data.Text.Internal.Lazy.Text -- | Overloaded type-level natural numbers. module Overloaded.TypeNats -- | A way to overload type level Nats. -- -- A number type-literal 42 is desugared to -- --
--   FromNat 42
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeNats #-}
--   
class FromNatC a where { type family FromNat (n :: Nat) :: a; } instance Overloaded.TypeNats.FromNatC GHC.Types.Nat instance Overloaded.TypeNats.FromNatC Data.Nat.Nat -- | Overloaded type-level symbols. module Overloaded.TypeSymbols -- | A way to overload type level Symbols. -- -- A symbol type-literal "example" is desugared to -- --
--   FromTypeSymbol "example"
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeSymbols #-}
--   
class FromTypeSymbolC a where { type family FromTypeSymbol (s :: Symbol) :: a; } instance Overloaded.TypeSymbols.FromTypeSymbolC GHC.Types.Symbol -- | Overloaded* language extensions as a source plugin. module Overloaded -- | Overloaded plugin. -- -- To enable plugin put the following at top of the module: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-}
--   
-- -- At least one option is required, multiple can given either using -- multiple -fplugin-opt options, or by separating options with -- colon: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols:Numerals #-}
--   
-- -- Options also take optional desugaring names, for example -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Labels=Data.Generics.ProductFields.field #-}
--   
-- -- to desugar OverloadedLabels directly into field from -- generics-lens (no need to import orphan instance!) -- --

Supported options

-- -- -- --

Known limitations

-- -- -- --

RecordFields

-- -- WARNING the type-checker plugin is experimental, it's adviced -- to use -- --
--   {-# OPTIONS_GHC -ddump-simpl #-}
--   
-- -- to avoid surprising segfaults. -- --

Usage

-- -- {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:RecordFields -- #-} -- --

Implementation bits

-- -- See Note [HasField instances] in ClsInst, the behavior of this -- plugin is similar. -- -- The HasField class is defined in GHC.Records.Compat -- module of record-hasfield package: -- --
--   class HasField {k} x r a | x r -> a where
--       hasField :: r -> (a -> r, a)
--   
-- -- Suppose we have -- --
--   data R y = MkR { foo :: [y] }
--   
-- -- and foo in scope. We will solve constraints like -- --
--   HasField "foo" (R Int) a
--   
-- -- by emitting a new wanted constraint -- --
--   [Int] ~# a
--   
-- -- and building a HasField dictionary out of selector -- foo appropriately cast. -- --

Idiom brackets from TemplateHaskellQuotes

-- --
--   {-# LANGUAGE TemplateHaskellQuotes #-}
--   {-# OPTIONS_GHC -fplugin=Overloaded -fplugin-opt=Overloaded:IdiomBrackets #-}
--   
--   data Tree a
--       = Leaf a
--       | Branch (Tree a) (Tree a)
--     deriving (Show)
--   
--   instance Functor Tree where
--       fmap f (Leaf x)     = Leaf (f x)
--       fmap f (Branch l r) = Branch (fmap f l) (fmap f r)
--   
--   instance Traversable Tree where
--       traverse f (Leaf x)     = [| Leaf (f x) |]
--       traverse f (Branch l r) = [| Branch (traverse f l) (traverse f r) |]
--   
plugin :: Plugin -- | Another way to desugar overloaded string literals using this class. -- -- A string literal "example" is desugared to -- --
--   fromSymbol @"example"
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-}
--   
class FromSymbol (s :: Symbol) a fromSymbol :: FromSymbol s a => a -- | Another way to desugar numerals. -- -- A numeric literal 123 is desugared to -- --
--   fromNumeral @123
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Numerals #-}
--   
-- -- One can do type-level computations with this. class FromNumeral (n :: Nat) a fromNumeral :: FromNumeral n a => a -- | Default implementation of fromNumeral. -- -- Usage example: -- --
--   instance (KnownNat n, ...) => FromNumeral n MyType where
--       fromNumeral = defaultFromNumeral @n
--   
defaultFromNumeral :: forall n a. (KnownNat n, Integral a) => a -- | Class for Natural-like datastructures -- -- A numeric literal 42 is desugared to -- --
--   fromNatural 42
--   
class FromNatural a fromNatural :: FromNatural a => Natural -> a -- | Class for Char-like datastructures -- -- A character literal x is desugared to -- --
--   fromChar 'x'
--   
class FromChar a fromChar :: FromChar a => Char -> a -- | Class for nil, [] -- -- See test-suite for ways to define instances for Map. There are -- at-least two-ways. class Nil a nil :: Nil a => a -- | Class for Cons :. class Cons x ys zs | zs -> x ys cons :: Cons x ys zs => x -> ys -> zs -- | Class for Bool-like datastrucutres -- -- An if--expression if b then t else e is desugared to -- --
--   ifte (toBool b) t e
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:If #-}
--   
class ToBool b toBool :: ToBool b => b -> Bool -- | ToBool overloaded if-expression. ifte :: ToBool b => b -> a -> a -> a -- | A way to overload type level Nats. -- -- A number type-literal 42 is desugared to -- --
--   FromNat 42
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeNats #-}
--   
class FromNatC a where { type family FromNat (n :: Nat) :: a; } -- | A way to overload type level Symbols. -- -- A symbol type-literal "example" is desugared to -- --
--   FromTypeSymbol "example"
--   
-- -- Enabled with: -- --
--   {-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeSymbols #-}
--   
class FromTypeSymbolC a where { type family FromTypeSymbol (s :: Symbol) :: a; }