-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acfde57
commit e4e91f5
Showing
15 changed files
with
2,310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>Data.Singletons.Dict</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">singletons-dict-getter-1.0.0: TH generation of Dict getters for promoted nullary data constructors.</span><ul class="links" id="page-menu"><li><a href="src/Data.Singletons.Dict.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Data.Singletons.Dict</p></div><div id="synopsis"><details id="syn"><summary>Synopsis</summary><ul class="details-toggle" data-details-id="syn"><li class="src short"><a href="#v:mkTotalDictGetter">mkTotalDictGetter</a> :: <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a> -> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a> -> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Q" title="Language.Haskell.TH.Syntax">Q</a> [<a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Dec" title="Language.Haskell.TH.Syntax">Dec</a>]</li><li class="src short"><a href="#v:mkPartialDictGetter">mkPartialDictGetter</a> :: <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a> -> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a> -> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Q" title="Language.Haskell.TH.Syntax">Q</a> [<a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Dec" title="Language.Haskell.TH.Syntax">Dec</a>]</li></ul></details></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:mkTotalDictGetter" class="def">mkTotalDictGetter</a> <a href="src/Data.Singletons.Dict.html#mkTotalDictGetter" class="link">Source</a> <a href="#v:mkTotalDictGetter" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></td><td class="doc"><p>The <code><a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></code> of a <code>singletons</code>-like type.</p></td></tr><tr><td class="src">-> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></td><td class="doc"><p>The <code><a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></code> of a type class.</p></td></tr><tr><td class="src">-> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Q" title="Language.Haskell.TH.Syntax">Q</a> [<a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Dec" title="Language.Haskell.TH.Syntax">Dec</a>]</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Generates <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> getters for the promoted nullary data constructors corresponding to | ||
a <code>singletons</code>-like type.</p><p><strong>All the promoted data constructors must be instances of the given type class.</strong></p><p>The names of the getters result from the concatenation of:</p><ul><li>the camel-cased name of the base type,</li><li>the name of the type class,</li><li>the "<code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code>" keyword,</li><li>the "A" suffix, for the contextual getter.</li></ul><p><em>Example:</em></p><p>Given this type:</p><pre>data Example = Foo | Bar | Baz | ||
</pre><p>and the corresponding <code>singletons</code>-like type:</p><pre>data SExample (example :: Example) where | ||
SFoo :: SExample 'Foo | ||
SBar :: SExample 'Bar | ||
SBaz :: SExample 'Baz | ||
</pre><p>this line:</p><pre>$(mkTotalDictGetter ''SExample ''<code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Type-Reflection.html#t:Typeable" title="Type.Reflection">Typeable</a></code>) | ||
</pre><p>generates those getters:</p><pre>exampleTypeableDict :: SExample example -> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> (<code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Type-Reflection.html#t:Typeable" title="Type.Reflection">Typeable</a></code> example) | ||
exampleTypeableDict sing = | ||
case sing of | ||
SFoo -> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
SBar -> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
SBaz -> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
|
||
exampleTypeableDictA :: <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#t:Applicative" title="Control.Applicative">Applicative</a></code> f => SExample example -> f (<code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> (<code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Type-Reflection.html#t:Typeable" title="Type.Reflection">Typeable</a></code> example)) | ||
exampleTypeableDictA sing = | ||
case sing of | ||
SFoo -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#v:pure" title="Control.Applicative">pure</a></code> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
SBar -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#v:pure" title="Control.Applicative">pure</a></code> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
SBaz -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#v:pure" title="Control.Applicative">pure</a></code> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
</pre></div></div><div class="top"><p class="src"><a id="v:mkPartialDictGetter" class="def">mkPartialDictGetter</a> <a href="src/Data.Singletons.Dict.html#mkPartialDictGetter" class="link">Source</a> <a href="#v:mkPartialDictGetter" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></td><td class="doc"><p>The <code><a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></code> of a <code>singletons</code>-like type.</p></td></tr><tr><td class="src">-> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></td><td class="doc"><p>The <code><a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name" title="Language.Haskell.TH.Syntax">Name</a></code> of a type class.</p></td></tr><tr><td class="src">-> <a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Q" title="Language.Haskell.TH.Syntax">Q</a> [<a href="https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Dec" title="Language.Haskell.TH.Syntax">Dec</a>]</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Generates <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> getters for the promoted nullary data constructors corresponding to | ||
a <code>singletons</code>-like type.</p><p><strong>Not all the promoted data constructors must be instances of the given type class.</strong></p><p>The name of the getters results from the concatenation of:</p><ul><li>the camel-cased name of the base type,</li><li>the name of the type class,</li><li>the "<code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code>" keyword,</li><li>the "A" suffix, for the contextual getter.</li></ul><p><em>Example:</em></p><p>Given this type:</p><pre>data Example = Foo | Bar | Baz | ||
</pre><p>the corresponding <code>singletons</code>-like type:</p><pre>data SExample (example :: Example) where | ||
SFoo :: SExample 'Foo | ||
SBar :: SExample 'Bar | ||
SBaz :: SExample 'Baz | ||
</pre><p>and this type class and instance:</p><pre>class IsBar (a :: k) where | ||
|
||
instance IsBar 'Bar where | ||
</pre><p>this line:</p><pre>$(mkPartialDictGetter ''SExample ''IsBar) | ||
</pre><p>generates those getters:</p><pre>exampleIsBarDict :: SExample example -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#t:Maybe" title="Data.Maybe">Maybe</a></code> (<code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> (IsBar example)) | ||
exampleIsBarDict sing = | ||
case sing of | ||
SFoo -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#v:Nothing" title="Data.Maybe">Nothing</a></code> | ||
SBar -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#v:Just" title="Data.Maybe">Just</a></code> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> | ||
SBaz -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#v:Nothing" title="Data.Maybe">Nothing</a></code> | ||
|
||
exampleIsBarDictA :: <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#t:Applicative" title="Control.Applicative">Applicative</a></code> f => SExample example -> f (<code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#t:Maybe" title="Data.Maybe">Maybe</a></code> (<code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code> (IsBar example))) | ||
exampleIsBarDictA sing = | ||
case sing of | ||
SFoo -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#v:pure" title="Control.Applicative">pure</a></code> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#v:Nothing" title="Data.Maybe">Nothing</a></code> | ||
SBar -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#v:pure" title="Control.Applicative">pure</a></code> (<code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#v:Just" title="Data.Maybe">Just</a></code> <code><a href="https://hackage.haskell.org/package/constraints-0.12/docs/Data-Constraint.html#t:Dict" title="Data.Constraint">Dict</a></code>) | ||
SBaz -> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Control-Applicative.html#v:pure" title="Control.Applicative">pure</a></code> <code><a href="https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Maybe.html#v:Nothing" title="Data.Maybe">Nothing</a></code> | ||
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.0</p></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>singletons-dict-getter-1.0.0: TH generation of Dict getters for promoted nullary data constructors. (Index)</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">singletons-dict-getter-1.0.0: TH generation of Dict getters for promoted nullary data constructors.</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="index"><p class="caption">Index</p><table><tr><td class="src">mkPartialDictGetter</td><td class="module"><a href="Data-Singletons-Dict.html#v:mkPartialDictGetter" title="Data.Singletons.Dict">Data.Singletons.Dict</a></td></tr><tr><td class="src">mkTotalDictGetter</td><td class="module"><a href="Data-Singletons-Dict.html#v:mkTotalDictGetter" title="Data.Singletons.Dict">Data.Singletons.Dict</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.0</p></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"display_html":"<a href=\"#v:mkTotalDictGetter\">mkTotalDictGetter</a> :: <a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name\" title=\"Language.Haskell.TH.Syntax\">Name</a> -> <a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name\" title=\"Language.Haskell.TH.Syntax\">Name</a> -> <a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Q\" title=\"Language.Haskell.TH.Syntax\">Q</a> [<a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Dec\" title=\"Language.Haskell.TH.Syntax\">Dec</a>]","name":"mkTotalDictGetter","module":"Data.Singletons.Dict","link":"Data-Singletons-Dict.html#v:mkTotalDictGetter"},{"display_html":"<a href=\"#v:mkPartialDictGetter\">mkPartialDictGetter</a> :: <a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name\" title=\"Language.Haskell.TH.Syntax\">Name</a> -> <a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Name\" title=\"Language.Haskell.TH.Syntax\">Name</a> -> <a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Q\" title=\"Language.Haskell.TH.Syntax\">Q</a> [<a href=\"https://hackage.haskell.org/package/template-haskell-2.16.0.0/docs/Language-Haskell-TH-Syntax.html#t:Dec\" title=\"Language.Haskell.TH.Syntax\">Dec</a>]","name":"mkPartialDictGetter","module":"Data.Singletons.Dict","link":"Data-Singletons-Dict.html#v:mkPartialDictGetter"}] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>singletons-dict-getter-1.0.0: TH generation of Dict getters for promoted nullary data constructors.</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">singletons-dict-getter-1.0.0: TH generation of Dict getters for promoted nullary data constructors.</span><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="description"><h1>singletons-dict-getter-1.0.0: TH generation of Dict getters for promoted nullary data constructors.</h1><div class="doc"><p>TH generation of Dict getters for promoted nullary data constructors, | ||
based on the corresponding singletons-like types.</p></div></div><div id="module-list"><p class="caption">Signatures</p></div><div id="module-list"><p class="caption">Modules</p><ul><li><span class="module details-toggle-control details-toggle" data-details-id="n.1">Data</span><details id="n.1" open="open"><summary class="hide-when-js-enabled">Submodules</summary><ul><li><span class="module details-toggle-control details-toggle" data-details-id="n.1.1">Singletons</span><details id="n.1.1" open="open"><summary class="hide-when-js-enabled">Submodules</summary><ul><li><span class="module"><span class="noexpander"> </span><a href="Data-Singletons-Dict.html">Data.Singletons.Dict</a></span></li></ul></details></li></ul></details></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.0</p></div></body></html> |
Oops, something went wrong.