From 0c0d4a75ed1037a13510a554dcd06e5e08aee1f7 Mon Sep 17 00:00:00 2001 From: Tom Ellis Date: Sun, 8 Sep 2024 09:02:37 +0100 Subject: [PATCH] Demonstrate isomorphism of one-type-parameter with multi --- .../src/Bluefin/Internal/Examples.hs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bluefin-internal/src/Bluefin/Internal/Examples.hs b/bluefin-internal/src/Bluefin/Internal/Examples.hs index 3a5f5cb..f20dfc9 100644 --- a/bluefin-internal/src/Bluefin/Internal/Examples.hs +++ b/bluefin-internal/src/Bluefin/Internal/Examples.hs @@ -963,3 +963,33 @@ runCounter7 stb y k = (State Int e, State Bool e, Stream String e) -> Eff (e :& es) r useImplk = useImpl @e . k + +foo :: + (e1 :> es, e2 :> es, e3 :> es) => + State () e1 -> + State Bool e2 -> + State Int e3 -> + Eff es () +foo _ _ _ = pure () + +bar :: + State () e -> + State Bool e -> + State Int e -> + Eff e () +bar _ _ _ = pure () + +barFromFoo :: + State () e -> + State Bool e -> + State Int e -> + Eff e () +barFromFoo = foo + +fooFromBar :: + (e1 :> es, e2 :> es, e3 :> es) => + State () e1 -> + State Bool e2 -> + State Int e3 -> + Eff es () +fooFromBar s1 s2 s3 = bar (mapHandle s1) (mapHandle s2) (mapHandle s3)