Created
May 17, 2019 18:57
-
-
Save subsetpark/ed1229cdd7945558cbd1e32de614f894 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import TypeClass | |
defmodule Minotaur do | |
defstruct name: "" | |
end | |
defimpl TypeClass.Property.Generator, for: Minotaur do | |
def generate(_), do: %Minotaur{name: "#{:crypto.strong_rand_bytes(2)}"} | |
end | |
definst Witchcraft.Semigroup, for: Minotaur do | |
def append(%Minotaur{name: a}, %Minotaur{name: b}), do: %Minotaur{name: "#{b} II, son of #{a}"} | |
end | |
definst Witchcraft.Monoid, for: Minotaur do | |
def empty(_), do: %Minotaur{} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment