This talk presents 3 programming situations where typeclasses and generics are not adequate: evolving serialization protocols, data generation, modular applications. A library, registry, can be used to help with those 3 situations by giving us the means to wire and rewire code at will.
6. What do they have in
common?
They form a graph
Each node in the
graph has a type
The graph is in
general acyclic
It is useful to modify the graph
• mock a component
• evolve the data model
• generate data differently
39. Bad idea n.2: use an effect library
tedious, hard to navigate…
Reify all operations
(from https://github.com/hasura/eff)
40. Need to know about: Algebra, Carrier,
type level operations etc…
Write interpreters
(from https://github.com/fused-effects/fused-effects)
Bad idea n.2: use an effect library
50. Where’s the catch?
YOU DON’T HAVE TO USE
TYPECLASSES TO WIRE YOUR CODE.
YOU JUST CREATE FUNCTIONS
AND PUT THEM IN A REGISTRY. THEN
YOU INVOKE THE INSTANCE YOU
NEED BY PASSING ITS TYPE. AND IF
YOU WANT TO INJECT ANOTHER
INSTANCE ITS EASY YOU CAN JUST
PUT ANOTHER FUNCTION ON TOP OF
THE LIST. YOU CAN EVEN ADD IT
ONLY TO A SUB PART OF THE GRAPH.
YOU LEARN THIS TECHNIQUE ONCE
AND APPLY IT TO MANY CONTEXTS:
APPLICATION WIRING, ENCODERS /
DECODERS, DATA GENERATION.
MOST MODIFICATIONS ARE LOCAL
AND YOU DON’T HAVE TO CHANGE
THE WIRING CODE, WHICH MAKES IT
IDEAL FOR MAINTENANCE. ON GITH