From b3d592be2538d6258837c8ac4a44ea99f99c4e13 Mon Sep 17 00:00:00 2001 From: Brooklyn Zelenka Date: Sat, 24 Oct 2015 18:26:02 -0700 Subject: [PATCH 01/11] Begun testing Monoid --- doc/Witchcraft.Monoid.Functions.html | 11 ++- doc/Witchcraft.Monoid.Properties.html | 129 +++++++++++++++++++------- doc/Witchcraft.Monoid.html | 20 ++-- doc/Witchcraft.html | 2 +- doc/dist/sidebar_items.js | 2 +- doc/extra-api-reference.html | 2 +- lib/witchcraft.ex | 23 +++++ lib/witchcraft/monoid.ex | 13 ++- lib/witchcraft/monoid/functions.ex | 1 + lib/witchcraft/monoid/properties.ex | 31 ++++--- test/monoid_test.exs | 20 ++++ 11 files changed, 189 insertions(+), 65 deletions(-) create mode 100644 test/monoid_test.exs diff --git a/doc/Witchcraft.Monoid.Functions.html b/doc/Witchcraft.Monoid.Functions.html index e7281e3..24a102f 100644 --- a/doc/Witchcraft.Monoid.Functions.html +++ b/doc/Witchcraft.Monoid.Functions.html @@ -122,12 +122,21 @@

a <|> b - + +
+

Specs

+
+ +
any <|> any :: any
+ +
+
+
diff --git a/doc/Witchcraft.Monoid.Properties.html b/doc/Witchcraft.Monoid.Properties.html index 60a6f96..7abc3d5 100644 --- a/doc/Witchcraft.Monoid.Properties.html +++ b/doc/Witchcraft.Monoid.Properties.html @@ -87,19 +87,6 @@

Summary

-
-

- Types -

-
-
- a() -
- -
- -
-
@@ -111,6 +98,24 @@

confirm_membership(candidates)

+ +
+ + +
+
+ + +
+
+ +
@@ -124,22 +129,6 @@

-
-

- - - - Types -

-
-
-
a :: any
- -
- -
-
-
@@ -156,7 +145,85 @@

confirm_membership(candidates) - + + + + + + +
+

Specs

+
+ +
confirm_membership([any]) :: boolean
+ +
+
+ +
+ +
+ +
+
+ + + + spotcheck(a, b, c) + + + + + +
+ +
+

Specs

+
+ +
spotcheck(any, any, any) :: boolean
+ +
+
+ +
+ +
+
+
+
+ + + + spotcheck_associativity(member1, member2, member3) + + + + + +
+ +
+

Specs

+
+ +
spotcheck_associativity(any, any, any) :: boolean
+ +
+
+ +
+ +
+
+
+
+ + + + spotcheck_identity(member) + + @@ -166,7 +233,7 @@

Specs

-
confirm_membership([a]) :: boolean
+
spotcheck_identity(any) :: boolean
diff --git a/doc/Witchcraft.Monoid.html b/doc/Witchcraft.Monoid.html index b00ddf5..5e466b9 100644 --- a/doc/Witchcraft.Monoid.html +++ b/doc/Witchcraft.Monoid.html @@ -75,7 +75,7 @@

-

Monoids are a set, plus a binary combining operation (op) that +

Monoids are a set of elements, and a binary combining operation (op) that returns another member of the set.

Properties

Associativity

@@ -97,16 +97,16 @@

Identity element

Examples

Theory

# Pseudocode
-id = 0
+identity = 0
 op = &(&1 + &2) # Integer addition
 op(34, id) == 34
# Pseudocode
-id = 1
+identity = 1
 op = &(&1 * &2) # Integer multiplication
 op(42, id) == 42

Concrete

iex> defimpl Monoid, for: Integer do
-iex>   def id(_), do: 0
+iex>   def identity(_), do: 0
 iex>   def op(a, b), do: a + b
 iex> end
 iex> Monoid.op(1, 4) |> Monoid.op 2 |> Monoid.op 10
@@ -115,7 +115,7 @@ 

Counter-Example

Integer division is not a monoid. Because you cannot divide by zero, the property does not hold for all values in the set.

Notes

-

You can of course use abuse this protocol to define a fake “monoid” that behaves differently. +

You can of course use abuse this protocol to define a fake ‘monoid’ that behaves differently. For the protocol to operate as intended, you need to respect the above properties.

@@ -151,7 +151,7 @@

Get the idenity (‘zero’) element of the monoid by passing in any element of the set

@@ -214,12 +214,12 @@

Functions

-
+
diff --git a/doc/Witchcraft.html b/doc/Witchcraft.html index 09794c0..c9ca4e2 100644 --- a/doc/Witchcraft.html +++ b/doc/Witchcraft.html @@ -65,7 +65,7 @@

Witchcraft - + diff --git a/doc/dist/sidebar_items.js b/doc/dist/sidebar_items.js index 4ac1aed..bd85a14 100644 --- a/doc/dist/sidebar_items.js +++ b/doc/dist/sidebar_items.js @@ -1 +1 @@ -sidebarNodes={"exceptions":[],"extras":[{"id":"extra-api-reference","title":"API Reference","headers":[]},{"id":"extra-readme","title":"README","headers":[{"id":" Installation","anchor":"Installation"}]}],"modules":[{"id":"ADT.Maybe","title":"ADT.Maybe","functions":[{"id":"from_status_tuple/1","anchor":"from_status_tuple/1"},{"id":"just?/1","anchor":"just?/1"},{"id":"nothing?/1","anchor":"nothing?/1"}]},{"id":"ADT.MaybePlus","title":"ADT.MaybePlus","functions":[{"id":"from_status_tuple/1","anchor":"from_status_tuple/1"},{"id":"just?/1","anchor":"just?/1"},{"id":"meta/1","anchor":"meta/1"},{"id":"nothing?/1","anchor":"nothing?/1"}],"types":[{"id":"maybe_plus/2","anchor":"t:maybe_plus/2"}]},{"id":"Witchcraft","title":"Witchcraft"},{"id":"Witchcraft.Applicative.Functions","title":"Witchcraft.Applicative.Functions","functions":[{"id":"<~>/2","anchor":"%3C~%3E/2"},{"id":"lift2/3","anchor":"lift2/3"},{"id":"lift3/4","anchor":"lift3/4"},{"id":"prior/2","anchor":"prior/2"},{"id":"then/2","anchor":"then/2"},{"id":"wrap/1","anchor":"wrap/1"}]},{"id":"Witchcraft.Applicative.Properties","title":"Witchcraft.Applicative.Properties","functions":[{"id":"homomorphism/2","anchor":"homomorphism/2"},{"id":"identity/2","anchor":"identity/2"}]},{"id":"Witchcraft.Arrow.Extra","title":"Witchcraft.Arrow.Extra","functions":[{"id":"fanout/2","anchor":"fanout/2"},{"id":"product/2","anchor":"product/2"}]},{"id":"Witchcraft.Category.Extra","title":"Witchcraft.Category.Extra","functions":[{"id":"compose_left_to_right/2","anchor":"compose_left_to_right/2"},{"id":"compose_right_to_left/2","anchor":"compose_right_to_left/2"}]},{"id":"Witchcraft.Functor.Functions","title":"Witchcraft.Functor.Functions","functions":[{"id":"<~/2","anchor":"%3C~/2"},{"id":"map_replace/2","anchor":"map_replace/2"},{"id":"~>/2","anchor":"~%3E/2"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"fa/0","anchor":"t:fa/0"},{"id":"fb/0","anchor":"t:fb/0"}]},{"id":"Witchcraft.Monad.Axioms","title":"Witchcraft.Monad.Axioms","functions":[{"id":"neutral_return/1","anchor":"neutral_return/1"},{"id":"neutral_return/2","anchor":"neutral_return/2"},{"id":"rewording/3","anchor":"rewording/3"}]},{"id":"Witchcraft.Monad.Functions","title":"Witchcraft.Monad.Functions","functions":[{"id":"bind/2","anchor":"bind/2"},{"id":"return/1","anchor":"return/1"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"ma/0","anchor":"t:ma/0"},{"id":"mb/0","anchor":"t:mb/0"}]},{"id":"Witchcraft.Monoid.Functions","title":"Witchcraft.Monoid.Functions","functions":[{"id":"<|>/2","anchor":"%3C%7C%3E/2"}]},{"id":"Witchcraft.Monoid.Properties","title":"Witchcraft.Monoid.Properties","functions":[{"id":"confirm_membership/1","anchor":"confirm_membership/1"}],"types":[{"id":"a/0","anchor":"t:a/0"}]},{"id":"Witchcraft.Utils","title":"Witchcraft.Utils","functions":[{"id":"compose/1","anchor":"compose/1"},{"id":"const/2","anchor":"const/2"},{"id":"id/1","anchor":"id/1"}]}],"protocols":[{"id":"Witchcraft.Applicative","title":"Witchcraft.Applicative","functions":[{"id":"apply/2","anchor":"apply/2"},{"id":"pure/1","anchor":"pure/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Arrow","title":"Witchcraft.Arrow","functions":[{"id":"arr/1","anchor":"arr/1"},{"id":"first/1","anchor":"first/1"},{"id":"second/1","anchor":"second/1"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"a_to_b/0","anchor":"t:a_to_b/0"},{"id":"arrow/3","anchor":"t:arrow/3"},{"id":"b/0","anchor":"t:b/0"},{"id":"b_to_c/0","anchor":"t:b_to_c/0"},{"id":"c/0","anchor":"t:c/0"},{"id":"split/2","anchor":"t:split/2"},{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Category","title":"Witchcraft.Category","functions":[{"id":"compose/2","anchor":"compose/2"},{"id":"id/1","anchor":"id/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Functor","title":"Witchcraft.Functor","functions":[{"id":"lift/2","anchor":"lift/2"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"r/0","anchor":"t:r/0"},{"id":"t/0","anchor":"t:t/0"},{"id":"wa/0","anchor":"t:wa/0"},{"id":"wr/0","anchor":"t:wr/0"}]},{"id":"Witchcraft.Monad","title":"Witchcraft.Monad","functions":[{"id":"join/1","anchor":"join/1"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Monoid","title":"Witchcraft.Monoid","functions":[{"id":"id/1","anchor":"id/1"},{"id":"member?/1","anchor":"member?/1"},{"id":"op/2","anchor":"op/2"}],"types":[{"id":"t/0","anchor":"t:t/0"}]}]} \ No newline at end of file +sidebarNodes={"exceptions":[],"extras":[{"id":"extra-api-reference","title":"API Reference","headers":[]},{"id":"extra-readme","title":"README","headers":[{"id":" Installation","anchor":"Installation"}]}],"modules":[{"id":"ADT.Maybe","title":"ADT.Maybe","functions":[{"id":"from_status_tuple/1","anchor":"from_status_tuple/1"},{"id":"just?/1","anchor":"just?/1"},{"id":"nothing?/1","anchor":"nothing?/1"}]},{"id":"ADT.MaybePlus","title":"ADT.MaybePlus","functions":[{"id":"from_status_tuple/1","anchor":"from_status_tuple/1"},{"id":"just?/1","anchor":"just?/1"},{"id":"meta/1","anchor":"meta/1"},{"id":"nothing?/1","anchor":"nothing?/1"}],"types":[{"id":"maybe_plus/2","anchor":"t:maybe_plus/2"}]},{"id":"Witchcraft","title":"Witchcraft"},{"id":"Witchcraft.Applicative.Functions","title":"Witchcraft.Applicative.Functions","functions":[{"id":"<~>/2","anchor":"%3C~%3E/2"},{"id":"lift2/3","anchor":"lift2/3"},{"id":"lift3/4","anchor":"lift3/4"},{"id":"prior/2","anchor":"prior/2"},{"id":"then/2","anchor":"then/2"},{"id":"wrap/1","anchor":"wrap/1"}]},{"id":"Witchcraft.Applicative.Properties","title":"Witchcraft.Applicative.Properties","functions":[{"id":"homomorphism/2","anchor":"homomorphism/2"},{"id":"identity/2","anchor":"identity/2"}]},{"id":"Witchcraft.Arrow.Extra","title":"Witchcraft.Arrow.Extra","functions":[{"id":"fanout/2","anchor":"fanout/2"},{"id":"product/2","anchor":"product/2"}]},{"id":"Witchcraft.Category.Extra","title":"Witchcraft.Category.Extra","functions":[{"id":"compose_left_to_right/2","anchor":"compose_left_to_right/2"},{"id":"compose_right_to_left/2","anchor":"compose_right_to_left/2"}]},{"id":"Witchcraft.Functor.Functions","title":"Witchcraft.Functor.Functions","functions":[{"id":"<~/2","anchor":"%3C~/2"},{"id":"map_replace/2","anchor":"map_replace/2"},{"id":"~>/2","anchor":"~%3E/2"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"fa/0","anchor":"t:fa/0"},{"id":"fb/0","anchor":"t:fb/0"}]},{"id":"Witchcraft.Monad.Axioms","title":"Witchcraft.Monad.Axioms","functions":[{"id":"neutral_return/1","anchor":"neutral_return/1"},{"id":"neutral_return/2","anchor":"neutral_return/2"},{"id":"rewording/3","anchor":"rewording/3"}]},{"id":"Witchcraft.Monad.Functions","title":"Witchcraft.Monad.Functions","functions":[{"id":"bind/2","anchor":"bind/2"},{"id":"return/1","anchor":"return/1"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"ma/0","anchor":"t:ma/0"},{"id":"mb/0","anchor":"t:mb/0"}]},{"id":"Witchcraft.Monoid.Functions","title":"Witchcraft.Monoid.Functions","functions":[{"id":"<|>/2","anchor":"%3C%7C%3E/2"}]},{"id":"Witchcraft.Monoid.Properties","title":"Witchcraft.Monoid.Properties","functions":[{"id":"confirm_membership/1","anchor":"confirm_membership/1"},{"id":"spotcheck/3","anchor":"spotcheck/3"},{"id":"spotcheck_associativity/3","anchor":"spotcheck_associativity/3"},{"id":"spotcheck_identity/1","anchor":"spotcheck_identity/1"}]},{"id":"Witchcraft.Utils","title":"Witchcraft.Utils","functions":[{"id":"compose/1","anchor":"compose/1"},{"id":"const/2","anchor":"const/2"},{"id":"id/1","anchor":"id/1"}]}],"protocols":[{"id":"Witchcraft.Applicative","title":"Witchcraft.Applicative","functions":[{"id":"apply/2","anchor":"apply/2"},{"id":"pure/1","anchor":"pure/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Arrow","title":"Witchcraft.Arrow","functions":[{"id":"arr/1","anchor":"arr/1"},{"id":"first/1","anchor":"first/1"},{"id":"second/1","anchor":"second/1"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"a_to_b/0","anchor":"t:a_to_b/0"},{"id":"arrow/3","anchor":"t:arrow/3"},{"id":"b/0","anchor":"t:b/0"},{"id":"b_to_c/0","anchor":"t:b_to_c/0"},{"id":"c/0","anchor":"t:c/0"},{"id":"split/2","anchor":"t:split/2"},{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Category","title":"Witchcraft.Category","functions":[{"id":"compose/2","anchor":"compose/2"},{"id":"id/1","anchor":"id/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Functor","title":"Witchcraft.Functor","functions":[{"id":"lift/2","anchor":"lift/2"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"r/0","anchor":"t:r/0"},{"id":"t/0","anchor":"t:t/0"},{"id":"wa/0","anchor":"t:wa/0"},{"id":"wr/0","anchor":"t:wr/0"}]},{"id":"Witchcraft.Monad","title":"Witchcraft.Monad","functions":[{"id":"join/1","anchor":"join/1"}],"types":[{"id":"a/0","anchor":"t:a/0"},{"id":"t/0","anchor":"t:t/0"}]},{"id":"Witchcraft.Monoid","title":"Witchcraft.Monoid","functions":[{"id":"identity/1","anchor":"identity/1"},{"id":"member?/1","anchor":"member?/1"},{"id":"op/2","anchor":"op/2"}],"types":[{"id":"t/0","anchor":"t:t/0"}]}]} \ No newline at end of file diff --git a/doc/extra-api-reference.html b/doc/extra-api-reference.html index e75b24b..d3e3f7c 100644 --- a/doc/extra-api-reference.html +++ b/doc/extra-api-reference.html @@ -192,7 +192,7 @@

Protocols

-

Monoids are a set, plus a binary combining operation (op) that +

Monoids are a set of elements, and a binary combining operation (op) that returns another member of the set

diff --git a/lib/witchcraft.ex b/lib/witchcraft.ex index 189db1e..d1539f5 100644 --- a/lib/witchcraft.ex +++ b/lib/witchcraft.ex @@ -1,2 +1,25 @@ defmodule Witchcraft do + import Witchcraft.Monoid + import Witchcraft.Monoid.Functions + import Witchcraft.Monoid.Properties + + # import Witchcraft.Functor + # import Witchcraft.Functor.Functions + # import Witchcraft.Functor.Properties + + # import Witchcraft.Applicative + # import Witchcraft.Applicative.Functions + # import Witchcraft.Applicative.Properties + + # import Witchcraft.Monad + # import Witchcraft.Monad.Functions + # import Witchcraft.Monad.Properties + + # import Witchcraft.Catgegory + # import Witchcraft.Catgegory.Functions + # import Witchcraft.Catgegory.Properties + + # import Witchcraft.Arrow + # import Witchcraft.Arrow.Functions + # import Witchcraft.Arrow.Properties end diff --git a/lib/witchcraft/monoid.ex b/lib/witchcraft/monoid.ex index 5756f94..9ee72ec 100644 --- a/lib/witchcraft/monoid.ex +++ b/lib/witchcraft/monoid.ex @@ -1,6 +1,6 @@ defprotocol Witchcraft.Monoid do @moduledoc ~S""" - Monoids are a set, plus a binary combining operation (`op`) that + Monoids are a set of elements, and a binary combining operation (`op`) that returns another member of the set. # Properties @@ -18,26 +18,29 @@ defprotocol Witchcraft.Monoid do ``` # Pseudocode - id = 0 + identity = 0 op = &(&1 + &2) # Integer addition op(34, id) == 34 ``` ``` # Pseudocode - id = 1 + identity = 1 op = &(&1 * &2) # Integer multiplication op(42, id) == 42 ``` ## Concrete ``` + + iex> alias Witchcraft.Monoid, as: Monoid iex> defimpl Monoid, for: Integer do - iex> def id(_), do: 0 + iex> def identity(_), do: 0 iex> def op(a, b), do: a + b iex> end iex> Monoid.op(1, 4) |> Monoid.op 2 |> Monoid.op 10 17 + ``` ## Counter-Example @@ -57,7 +60,7 @@ defprotocol Witchcraft.Monoid do def member?(value) @doc "Get the idenity ('zero') element of the monoid by passing in any element of the set" - @spec id(any) :: any + @spec identity(any) :: any def identity(a) @doc "Combine two members of the monoid, and return another member" diff --git a/lib/witchcraft/monoid/functions.ex b/lib/witchcraft/monoid/functions.ex index fff8df5..66adb6c 100644 --- a/lib/witchcraft/monoid/functions.ex +++ b/lib/witchcraft/monoid/functions.ex @@ -1,5 +1,6 @@ defmodule Witchcraft.Monoid.Functions do alias Witchcraft.Monoid, as: Mon + @spec any <|> any :: any def a <|> b, do: Mon.op(a, b) end diff --git a/lib/witchcraft/monoid/properties.ex b/lib/witchcraft/monoid/properties.ex index 129f6c4..272bd09 100644 --- a/lib/witchcraft/monoid/properties.ex +++ b/lib/witchcraft/monoid/properties.ex @@ -3,25 +3,26 @@ defmodule Witchcraft.Monoid.Properties do Check samples to confirm that your data adheres to monoidal properties """ - alias Witchcraft.Monoid, as: Mon + import Witchcraft.Monoid + import Witchcraft.Monoid.Functions - @type a :: any - - @spec confirm_membership([a]) :: boolean + @spec confirm_membership([any]) :: boolean def confirm_membership(candidates) do - Enum.reduce(candidates, true, &(&2 and Mon.member?(&1))) + Enum.reduce(candidates, true, &(&2 and member?(&1))) end - # @spec test_id :: boolean - # def spotcheck_id(member) do - # op(identity, member) == member - # end + @spec spotcheck_identity(any) :: boolean + def spotcheck_identity(member) do + (Mon.identity(member) <|> member) == member + end - # def spotcheck_associativity(member1, member2, member3) do - # op(member1, member2) |> op(member3) == member1 |> op(op(member2, member3)) - # end + @spec spotcheck_associativity(any, any, any) :: boolean + def spotcheck_associativity(member1, member2, member3) do + (member1 <|> (member2 <|> member3)) == ((member1 <|> member2) <|> member3) + end - # def spotcheck(a, b, c) do - # confirm_membership([a, b, c]) and spotcheck_id(a) and spotcheck_associativity(a, b, c) - # end + @spec spotcheck(any, any, any) :: boolean + def spotcheck(a, b, c) do + confirm_membership([a, b, c]) and spotcheck_identity(a) and spotcheck_associativity(a, b, c) + end end diff --git a/test/monoid_test.exs b/test/monoid_test.exs new file mode 100644 index 0000000..0111fcd --- /dev/null +++ b/test/monoid_test.exs @@ -0,0 +1,20 @@ +defmodule MonoidTest do + use ExUnit.Case + + import Witchcraft.Monoid + import Witchcraft.Monoid.Functions + import Witchcraft.Monoid.Properties + + doctest Witchcraft.Monoid + doctest Witchcraft.Monoid.Functions + doctest Witchcraft.Monoid.Properties + + defimpl Witchcraft.Monoid, for: Integer do + def identity(_), do: 0 + def op(a, b), do: a + b + end + + test "left identity" do + assert (identity(9) <|> 42) == 42 + end +end From 956aa5c6e41c47410b66de23ddc18e3507d1a35e Mon Sep 17 00:00:00 2001 From: Brooklyn Zelenka Date: Sat, 24 Oct 2015 19:00:33 -0700 Subject: [PATCH 02/11] Test Monoid props --- lib/witchcraft/monoid.ex | 7 ----- lib/witchcraft/monoid/properties.ex | 13 ++++----- test/monoid_test.exs | 44 ++++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/lib/witchcraft/monoid.ex b/lib/witchcraft/monoid.ex index 9ee72ec..d7e47ea 100644 --- a/lib/witchcraft/monoid.ex +++ b/lib/witchcraft/monoid.ex @@ -52,13 +52,6 @@ defprotocol Witchcraft.Monoid do For the protocol to operate as intended, you need to respect the above properties. """ - @doc """ - Check if the argument is a member of the monoid. - Doubles as a definition of what belongs to the monoid. - """ - @spec member?(any) :: boolean - def member?(value) - @doc "Get the idenity ('zero') element of the monoid by passing in any element of the set" @spec identity(any) :: any def identity(a) diff --git a/lib/witchcraft/monoid/properties.ex b/lib/witchcraft/monoid/properties.ex index 272bd09..bc1f2ef 100644 --- a/lib/witchcraft/monoid/properties.ex +++ b/lib/witchcraft/monoid/properties.ex @@ -1,19 +1,16 @@ defmodule Witchcraft.Monoid.Properties do @moduledoc """ - Check samples to confirm that your data adheres to monoidal properties + Check samples to confirm that your data adheres to monoidal properties. + All members of your datatype should adhere to these rules. + There are placed here as a quick way to spotcheck some of your values. """ import Witchcraft.Monoid import Witchcraft.Monoid.Functions - @spec confirm_membership([any]) :: boolean - def confirm_membership(candidates) do - Enum.reduce(candidates, true, &(&2 and member?(&1))) - end - @spec spotcheck_identity(any) :: boolean def spotcheck_identity(member) do - (Mon.identity(member) <|> member) == member + (identity(member) <|> member) == member end @spec spotcheck_associativity(any, any, any) :: boolean @@ -23,6 +20,6 @@ defmodule Witchcraft.Monoid.Properties do @spec spotcheck(any, any, any) :: boolean def spotcheck(a, b, c) do - confirm_membership([a, b, c]) and spotcheck_identity(a) and spotcheck_associativity(a, b, c) + spotcheck_identity(a) and spotcheck_associativity(a, b, c) end end diff --git a/test/monoid_test.exs b/test/monoid_test.exs index 0111fcd..2c9ca55 100644 --- a/test/monoid_test.exs +++ b/test/monoid_test.exs @@ -9,12 +9,48 @@ defmodule MonoidTest do doctest Witchcraft.Monoid.Functions doctest Witchcraft.Monoid.Properties - defimpl Witchcraft.Monoid, for: Integer do - def identity(_), do: 0 - def op(a, b), do: a + b + # Happy case: Strings + defimpl Witchcraft.Monoid, for: BitString do + def identity(_), do: "" + def op(a, b), do: a <> b + end + + # Sad case: Malformed floats under division + defimpl Witchcraft.Monoid, for: Float do + def identity(_), do: -9.0 + def op(a, b), do: a / b + end + + + test "identity always returns the same value for that datatype" do + assert identity("a") == identity("b") + end + + test "identity combined with itself is the identity" do + assert identity("") <|> identity("") == identity("") end test "left identity" do - assert (identity(9) <|> 42) == 42 + assert identity("welp") <|> "o hai" == "o hai" + end + + test "right identity" do + assert "o hai" <|> identity("welp") == "o hai" + end + + test "spotcheck_identity is true for well formed monoids" do + assert spotcheck_identity("well formed") == true + end + + test "spotcheck_identity is false for malformed monoids" do + assert spotcheck_identity(88.8) == false + end + + test "spotcheck_associativity returns true when monoid is well formed" do + assert spotcheck_associativity("a", "b", "c") == true + end + + test "spotcheck_associativity returns false when monoid is poorly formed" do + assert spotcheck_associativity(-9.1, 42.0, 88.8) == false end end From 8dc863f25aa19cb520a1a37679dc5575e406e25a Mon Sep 17 00:00:00 2001 From: Brooklyn Zelenka Date: Sat, 24 Oct 2015 19:18:57 -0700 Subject: [PATCH 03/11] Bring back styles for docs --- doc/Witchcraft.Monoid.Properties.html | 60 ++++++++++----------------- doc/Witchcraft.Monoid.html | 45 ++------------------ doc/dist/app.css | 1 + doc/dist/app.js | 6 +++ doc/dist/sidebar_items.js | 2 +- doc/extra-api-reference.html | 4 +- lib/witchcraft/monoid/properties.ex | 10 +++++ 7 files changed, 47 insertions(+), 81 deletions(-) create mode 100644 doc/dist/app.css create mode 100644 doc/dist/app.js diff --git a/doc/Witchcraft.Monoid.Properties.html b/doc/Witchcraft.Monoid.Properties.html index 7abc3d5..ed88b53 100644 --- a/doc/Witchcraft.Monoid.Properties.html +++ b/doc/Witchcraft.Monoid.Properties.html @@ -73,7 +73,9 @@

-

Check samples to confirm that your data adheres to monoidal properties

+

Check samples to confirm that your data adheres to monoidal properties. +All members of your datatype should adhere to these rules. +There are placed here as a quick way to spotcheck some of your values.

@@ -95,14 +97,11 @@

+

Spotcheck all monoid properties

- +

Check that Monoid.op is associative +(ie: brackets don’t matter)

+
+
+

Check that some member of your monoid combines with the identity to return itself

+
+
@@ -138,40 +144,14 @@

Functions

-
-
- - - - confirm_membership(candidates) - - - - - -
- -
-

Specs

-
- -
confirm_membership([any]) :: boolean
- -
-
- -
- -
-
-
+
spotcheck(a, b, c) - + @@ -187,7 +167,8 @@

Specs

- +

Spotcheck all monoid properties

+
@@ -197,7 +178,7 @@

Specs

spotcheck_associativity(member1, member2, member3) - + @@ -213,7 +194,9 @@

Specs

- +

Check that Monoid.op is associative +(ie: brackets don’t matter)

+
@@ -239,7 +222,8 @@

Specs

- +

Check that some member of your monoid combines with the identity to return itself

+
diff --git a/doc/Witchcraft.Monoid.html b/doc/Witchcraft.Monoid.html index 5e466b9..1596c2f 100644 --- a/doc/Witchcraft.Monoid.html +++ b/doc/Witchcraft.Monoid.html @@ -105,7 +105,8 @@

Theory

op = &(&1 * &2) # Integer multiplication op(42, id) == 42

Concrete

-
iex> defimpl Monoid, for: Integer do
+
iex> alias Witchcraft.Monoid, as: Monoid
+iex> defimpl Monoid, for: Integer do
 iex>   def identity(_), do: 0
 iex>   def op(a, b), do: a + b
 iex> end
@@ -157,16 +158,6 @@ 

Get the idenity (‘zero’) element of the monoid by passing in any element of the set

-

-
- - -

Check if the argument is a member of the monoid. -Doubles as a definition of what belongs to the monoid

-
-
@@ -221,7 +212,7 @@

identity(a) - + @@ -241,34 +232,6 @@

Specs

-
-
- - - - member?(value) - - - - - -
- -
-

Specs

-
- -
member?(any) :: boolean
- -
-
- -
-

Check if the argument is a member of the monoid. -Doubles as a definition of what belongs to the monoid.

- -
-
@@ -276,7 +239,7 @@

Specs

op(a, b) - + diff --git a/doc/dist/app.css b/doc/dist/app.css new file mode 100644 index 0000000..6cdbfb6 --- /dev/null +++ b/doc/dist/app.css @@ -0,0 +1 @@ +@import url(https://fonts.googleapis.com/css?family=Lato:400,300,700,900|Merriweather:300italic,300,700,700italic|Inconsolata:400,700);.hljs,article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}img,legend{border:0}.sidebar a,.sidebar-toggle{transition:color .3s ease-in-out}.sidebar .sidebar-search .sidebar-searchInput:focus,.sidebar .sidebar-search .sidebar-searchInput:hover,.sidebar-toggle:active,.sidebar-toggle:focus,.sidebar-toggle:hover,a:active,a:hover{outline:0}.results ul,.sidebar ul{list-style:none}.hljs-comment{color:#8e908c}.css .hljs-class,.css .hljs-id,.css .hljs-pseudo,.hljs-attribute,.hljs-regexp,.hljs-tag,.hljs-variable,.html .hljs-doctype,.ruby .hljs-constant,.xml .hljs-doctype,.xml .hljs-pi,.xml .hljs-tag .hljs-title{color:#c82829}.hljs-built_in,.hljs-constant,.hljs-literal,.hljs-number,.hljs-params,.hljs-pragma,.hljs-preprocessor{color:#f5871f}.css .hljs-rule .hljs-attribute,.ruby .hljs-class .hljs-title{color:#eab700}.hljs-header,.hljs-inheritance,.hljs-name,.hljs-string,.hljs-value,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor,.hljs-title{color:#3e999f}.coffeescript .hljs-title,.hljs-function,.javascript .hljs-title,.perl .hljs-sub,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{overflow-x:auto;background:#fff;color:#4d4d4c;padding:.5em;-webkit-text-size-adjust:none}legend,td,th{padding:0}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .css,.xml .hljs-cdata,.xml .javascript,.xml .vbscript{opacity:.5}/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}.main,body,html{overflow:hidden}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}.content,.main,.sidebar,body,html{height:100%}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:icomoon;src:url(../fonts/icomoon.eot?h5z89e);src:url(../fonts/icomoon.eot?#iefixh5z89e) format('embedded-opentype'),url(../fonts/icomoon.ttf?h5z89e) format('truetype'),url(../fonts/icomoon.woff?h5z89e) format('woff'),url(../fonts/icomoon.svg?h5z89e#icomoon) format('svg');font-weight:400;font-style:normal}.icon-elem,[class*=" icon-"],[class^=icon-]{font-family:icomoon;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.sidebar,body{font-family:Lato,sans-serif}.icon-link:before{content:"\e005"}.icon-search:before{content:"\e036"}.icon-cross:before{content:"\e117"}.icon-menu:before{content:"\e120"}.icon-angle-right:before{content:"\f105"}.icon-code:before{content:"\f121"}body,html{box-sizing:border-box;width:100%}body{margin:0;font-size:16px;line-height:1.6875em}*,:after,:before{box-sizing:inherit}.main{display:-webkit-flex;display:-ms-flexbox;display:-ms-flex;display:flex}.sidebar,body.sidebar-closed .sidebar{display:none}.sidebar{-webkit-flex:0 1 300px;-moz-flex:0 1 300px;-ms-flex:0 1 300px;flex:0 1 300px;-ms-flex-positive:0;-ms-flex-negative:1;-ms-flex-preferred-size:300px;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-box-direction:normal;-moz-box-direction:normal;min-height:0;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:absolute;z-index:999}.content{-webkit-flex:1 1 .01%;-moz-flex:1 1 .01%;-ms-flex:1 1 .01%;flex:1 1 .01%;-ms-flex-positive:1;-ms-flex-negative:1;-ms-flex-preferred-size:.01%;overflow-y:auto;-webkit-overflow-scrolling:touch}.content-inner{max-width:949px;margin:0 auto;padding:3px 60px}@media screen and (max-width:768px){.content-inner{padding:27px 20px 27px 40px}}body.sidebar-closed .sidebar-toggle{display:block}.sidebar-toggle{position:fixed;z-index:99;left:18px;top:8px;background-color:transparent;border:none;padding:0;font-size:16px}.sidebar-toggle:hover{color:#e1e1e1}@media screen and (min-width:768px){.sidebar-toggle{display:none}}.sidebar{font-size:14px;line-height:18px;background:#373f52;color:#d5dae6;overflow:hidden}.sidebar .sidebar-toggle{display:block;left:275px;color:#e1e1e1}.sidebar .sidebar-toggle:hover{color:#fff}.sidebar ul li{margin:0;padding:0 10px}.sidebar a{color:#d5dae6;text-decoration:none}.sidebar a:hover{color:#fff}.sidebar .sidebar-projectLink{margin:23px 30px 0}.sidebar .sidebar-projectDetails{display:inline-block;text-align:right;vertical-align:top;margin-top:6px}.sidebar .sidebar-projectImage{display:inline-block;max-width:64px;max-height:64px;margin-left:15px;vertical-align:bottom}.sidebar .sidebar-projectName{font-weight:700;font-size:24px;line-height:30px;color:#fff;margin:0;padding:0;max-width:155px}.sidebar .sidebar-projectVersion{margin:0;padding:0;font-weight:300;font-size:16px;line-height:20px;color:#fff}.sidebar .sidebar-listNav{padding:0 30px}.sidebar .sidebar-listNav li,.sidebar .sidebar-listNav li a{text-transform:uppercase;font-weight:300;font-size:13px}.sidebar .sidebar-listNav li{padding-left:17px;border-left:3px solid transparent;transition:all .3s linear;line-height:27px}.sidebar .sidebar-listNav li.selected,.sidebar .sidebar-listNav li.selected a,.sidebar .sidebar-listNav li:hover,.sidebar .sidebar-listNav li:hover a{border-color:#9768d1;color:#fff}.sidebar .sidebar-search{margin:23px 30px 18px;display:-webkit-flex;display:-ms-flexbox;display:-ms-flex;display:flex}.sidebar .sidebar-search i.icon-search{font-size:14px;color:#d5dae6}.sidebar #full-list li.clicked>a,.sidebar #full-list ul li.active a{color:#fff}.sidebar .sidebar-search .sidebar-searchInput{background-color:transparent;border:none;border-radius:0;border-bottom:1px solid #959595;margin-left:5px}.sidebar #full-list{margin:4px 0 0 30px;padding:0 20px;overflow-y:auto;-webkit-overflow-scrolling:touch;-webkit-flex:1 1 .01%;-moz-flex:1 1 .01%;-ms-flex:1 1 .01%;flex:1 1 .01%;-ms-flex-positive:1;-ms-flex-negative:1;-ms-flex-preferred-size:.01%}.sidebar #full-list ul{margin:0 20px;padding:9px 0 18px}.sidebar #full-list ul li{font-weight:300;line-height:18px}.sidebar #full-list ul li ul{display:none;padding:9px 0}.sidebar #full-list ul li ul li{border-left:1px solid #959595;padding:0 10px}.sidebar #full-list ul li ul li.active:before{font-family:icomoon;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f105";margin-left:-10px;font-size:16px;margin-right:5px}.sidebar #full-list ul li.active{border-left:none}.sidebar #full-list ul li.active ul{display:block}.sidebar #full-list li{padding:0;line-height:27px}.sidebar #full-list li.collapsed ul{display:none}@media screen and (min-width:768px){.sidebar{position:relative;display:-webkit-flex;display:-ms-flexbox;display:-ms-flex;display:flex}}@media screen and (max-height:500px){.sidebar{overflow-y:auto}.sidebar #full-list{overflow:visible}}.content-inner{font-family:Merriweather,serif;font-size:1em;line-height:1.6875em}.content-inner h1,.content-inner h2,.content-inner h3,.content-inner h4,.content-inner h5,.content-inner h6{font-family:Lato,sans-serif;font-weight:800;line-height:1.5em;word-wrap:break-word}.content-inner h1{font-size:2em;margin:1em 0 .5em}.content-inner h1.section-heading{margin:1.5em 0 .5em}.content-inner h1 small{font-weight:300}.content-inner h1 a.view-source{font-size:1.2rem}.content-inner h2{font-size:1.625em;margin:1em 0 .5em;font-weight:400}.content-inner h3{font-size:1.375em;margin:1em 0 .5em;font-weight:600}.content-inner a{color:#000;text-decoration:none;text-shadow:.03em 0 #fff,-.03em 0 #fff,0 .03em #fff,0 -.03em #fff,.06em 0 #fff,-.06em 0 #fff,.09em 0 #fff,-.09em 0 #fff,.12em 0 #fff,-.12em 0 #fff,.15em 0 #fff,-.15em 0 #fff;background-image:linear-gradient(#fff,#fff),linear-gradient(#fff,#fff),linear-gradient(#000,#000);background-size:.05em 1px,.05em 1px,1px 1px;background-repeat:no-repeat,no-repeat,repeat-x;background-position:0 90%,100% 90%,0 90%}.content-inner a:selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.content-inner a:-moz-selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.content-inner a *,.content-inner a :after,.content-inner a :before,.content-inner a:after,.content-inner a:before{text-shadow:none}.content-inner a:visited{color:#000}.content-inner ul li{line-height:1.5em}.content-inner a.view-source{float:right;color:#959595;background:0 0;border:none;text-shadow:none;transition:color .3s ease-in-out}.content-inner a.view-source:hover{color:#373f52}.content-inner blockquote{font-style:italic;margin:.5em 0;padding:.25em 1.5em;border-left:3px solid #e1e1e1;display:inline-block}.content-inner blockquote :first-child{padding-top:0;margin-top:0}.content-inner blockquote :last-child{padding-bottom:0;margin-bottom:0}.content-inner table{margin:2em 0}.content-inner th{text-align:left;font-family:Lato,sans-serif;text-transform:uppercase;font-weight:600;padding-bottom:.5em}.content-inner tr{border-bottom:1px solid #d5dae6;vertical-align:bottom;height:2.5em}.content-inner .summary .summary-row .summary-signature a,.content-inner .summary h2 a{background:0 0;border:none;text-shadow:none}.content-inner td,.content-inner th{padding-left:1em;line-height:2em}.content-inner h1.section-heading:hover a.hover-link{opacity:1;text-decoration:none}.content-inner h1.section-heading a.hover-link{transition:opacity .3s ease-in-out;display:inline-block;opacity:0;padding:.3em .6em .6em;line-height:1em;margin-left:-2.7em;background:0 0;border:none;text-shadow:none;font-size:16px;vertical-align:middle}.content-inner .summary h2{font-weight:600}.content-inner .summary .summary-row .summary-signature{font-family:Inconsolata,Menlo,Courier,monospace;font-weight:600}.content-inner .summary .summary-row .summary-synopsis{font-family:Merriweather,serif;font-style:italic;padding:0 .5em;margin:0 0 .5em}.content-inner .detail-header,.content-inner code{font-family:Inconsolata,Menlo,Courier,monospace}.content-inner .summary .summary-row .summary-synopsis p{margin:0;padding:0}.content-inner .detail-header{margin:2.5em 0 .5em;padding:.5em 1em;background:#f7f7f7;border-left:3px solid #9768d1;font-size:1em;position:relative}.content-inner .detail-header .signature{font-size:1rem;font-weight:600}.content-inner .detail-header:hover a.detail-link{opacity:1;text-decoration:none}.content-inner .detail-header a.detail-link{transition:opacity .3s ease-in-out;position:absolute;top:0;left:0;display:block;opacity:0;padding:.6em;line-height:1.5em;margin-left:-2.5em;background:0 0;border:none;text-shadow:none}.content-inner .specs .specs-list pre code,.content-inner .types .types-list .type-detail pre code{padding:0 .5em;border:none}.content-inner .specs .specs-list{margin:0 0 2em}.content-inner .specs .specs-list pre{margin:.5em 0}.content-inner .types .types-list .type-detail{margin-bottom:2em}.content-inner .types .types-list .type-detail pre{margin:.5em 0}.content-inner .types .types-list .type-detail .typespec-doc{padding:0 1.5em}.content-inner a.no-underline,.content-inner code a{color:#9768d1;text-shadow:none;background-image:none}.content-inner a.no-underline:active,.content-inner a.no-underline:focus,.content-inner a.no-underline:hover,.content-inner a.no-underline:visited,.content-inner code a:active,.content-inner code a:focus,.content-inner code a:hover,.content-inner code a:visited{color:#9768d1}.content-inner code{font-size:15px;font-style:normal;line-height:24px;font-weight:400;background-color:#f7f9fc;border:1px solid #e1e1e1;vertical-align:middle;border-radius:2px;padding:0 .5em}.content-inner pre{margin:1.5em 0}.content-inner pre.spec{margin:0}.content-inner pre.spec code{padding:0}.content-inner pre code.hljs{white-space:inherit;padding:1em 1.5em;background-color:#f7f9fc}.content-inner .footer{margin:4em auto 1em;text-align:center;font-style:italic;font-size:14px;color:#959595}.content-inner .footer .line{display:inline-block}.content-inner .footer a{color:#959595;text-decoration:none;text-shadow:.03em 0 #fff,-.03em 0 #fff,0 .03em #fff,0 -.03em #fff,.06em 0 #fff,-.06em 0 #fff,.09em 0 #fff,-.09em 0 #fff,.12em 0 #fff,-.12em 0 #fff,.15em 0 #fff,-.15em 0 #fff;background-image:linear-gradient(#fff,#fff),linear-gradient(#fff,#fff),linear-gradient(#959595,#959595);background-size:.05em 1px,.05em 1px,1px 1px;background-repeat:no-repeat,no-repeat,repeat-x;background-position:0 90%,100% 90%,0 90%}.content-inner .footer a:selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.content-inner .footer a:-moz-selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.results .result-id a,a.close-search{text-shadow:none;background-image:none;transition:color .3s ease-in-out}.content-inner .footer a *,.content-inner .footer a :after,.content-inner .footer a :before,.content-inner .footer a:after,.content-inner .footer a:before{text-shadow:none}.content-inner .footer a:visited{color:#959595}a.close-search{margin-top:-3em;display:block;float:right}a.close-search:active,a.close-search:focus,a.close-search:visited{color:#000}a.close-search:hover{color:#9768d1}.results .result-id{font-size:1.2em}.results .result-id a:active,.results .result-id a:focus,.results .result-id a:visited{color:#000}.results .result-id a:hover{color:#9768d1}.results .result-elem em,.results .result-id em{font-style:normal;color:#9768d1}.results ul{margin:0;padding:0}@media print{#sidebar{display:none}} diff --git a/doc/dist/app.js b/doc/dist/app.js new file mode 100644 index 0000000..955172c --- /dev/null +++ b/doc/dist/app.js @@ -0,0 +1,6 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,i){r.apply(this,[e,t,i].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){"use strict";var r=n(1)["default"],i=n(2),a=r(i),o=n(3),s=r(o),l=n(4),c=n(95);window.$=a["default"],a["default"](function(){s["default"].configure({tabReplace:" ",languages:[]}),c.initialize(),l.initialize(),s["default"].initHighlighting()})},function(e,t){"use strict";t["default"]=function(e){return e&&e.__esModule?e:{"default":e}},t.__esModule=!0},function(e,t,n){var r,i;!function(t,n){"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,a){function o(e){var t="length"in e&&e.length,n=re.type(e);return"function"===n||re.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function s(e,t,n){if(re.isFunction(t))return re.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return re.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(fe.test(t))return re.filter(t,e,n);t=re.filter(t,e)}return re.grep(e,function(e){return V.call(t,e)>=0!==n})}function l(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function c(e){var t=ye[e]={};return re.each(e.match(ve)||[],function(e,n){t[n]=!0}),t}function u(){te.removeEventListener("DOMContentLoaded",u,!1),n.removeEventListener("load",u,!1),re.ready()}function f(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=re.expando+f.uid++}function d(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ke,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ee.test(n)?re.parseJSON(n):n}catch(i){}we.set(e,t,n)}else n=void 0;return n}function p(){return!0}function h(){return!1}function g(){try{return te.activeElement}catch(e){}}function m(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function v(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function y(e){var t=Be.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function b(e,t){for(var n=0,r=e.length;r>n;n++)_e.set(e[n],"globalEval",!t||_e.get(t[n],"globalEval"))}function x(e,t){var n,r,i,a,o,s,l,c;if(1===t.nodeType){if(_e.hasData(e)&&(a=_e.access(e),o=_e.set(t,a),c=a.events)){delete o.handle,o.events={};for(i in c)for(n=0,r=c[i].length;r>n;n++)re.event.add(t,i,c[i][n])}we.hasData(e)&&(s=we.access(e),l=re.extend({},s),we.set(t,l))}}function _(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&re.nodeName(e,t)?re.merge([e],n):n}function w(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Se.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function E(e,t){var r,i=re(t.createElement(e)).appendTo(t.body),a=n.getDefaultComputedStyle&&(r=n.getDefaultComputedStyle(i[0]))?r.display:re.css(i[0],"display");return i.detach(),a}function k(e){var t=te,n=We[e];return n||(n=E(e,t),"none"!==n&&n||(ze=(ze||re("