Continuation of Encoding Overlapping, Extensible Isomorphisms: encoding "open kinds" to better express some awkward type classes.
Last active
January 26, 2020 20:53
-
-
Save Icelandjack/865476f2299a4916d4e237d0f8ed0119 to your computer and use it in GitHub Desktop.
Rethinking Tricky Classes: Explicit Witnesses of Monoid Actions, Semigroup / Monoid / Applicative homomorphisms
N
e
x
t
up
...
Adjunctions?
Really witnessed by a natural isomorphism (Iso1
).
Functors?
Once we go Category
polymorphic we start running into similar issues: See reddit thread.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We can also define a
Semigroup
action, and make it a super class ofMonoid
actions:Lifting a
Semigroup
action to aMonoid
actionIf we wanted to lift a
SemigroupAction
to aMonoidAction
in the style of semigroups-actions we would need to define anewtype OptionSet s a = OptionSet a
and the final type would look like:Using the approach under study the type becomes the more palatable
Option s -> (a -> a)
:Generalize Cayley to
Semigroup
Differentiating between
SemigroupAction
andMonoidAction
allows us to use the more general(<>)
in the definitionWith semigroups-actions
act
would get the unnecessarily wrapped typeSelfAct s -> (SelfAct s -> SelfAct s)
.Repeating n-times
Acting on
Enum
From
Data.Semigroup.Act.Enum
. Semigroup action of an integer acting on anEnum
.