Skip to content

Instantly share code, notes, and snippets.

@MarcelineVQ
Last active September 18, 2020 01:25
Show Gist options
  • Save MarcelineVQ/e3695adaa386f378803d577ec0d0b2d2 to your computer and use it in GitHub Desktop.
Save MarcelineVQ/e3695adaa386f378803d577ec0d0b2d2 to your computer and use it in GitHub Desktop.
`( [| ( x , y ) |] )
IAlternative
(UniqueDefault
(IApp
(IApp
(IVar (UN "<*>"))
(IApp
(IApp
(IVar (UN "<*>"))
(IApp
(IVar (UN "pure"))
(IVar (NS (MkNS ["Builtin"]) (UN "MkPair")))))
(IVar (UN "x"))))
(IVar (UN "y"))))
[IApp
(IApp
(IVar (UN "<*>"))
(IApp
(IApp
(IVar (UN "<*>"))
(IApp
(IVar (UN "pure"))
(IVar (NS (MkNS ["Builtin"]) (UN "Pair")))))
(IVar (UN "x"))))
(IVar (UN "y"))
,IApp
(IApp
(IVar (UN "<*>"))
(IApp
(IApp
(IVar (UN "<*>"))
(IApp
(IVar (UN "pure"))
(IVar (NS (MkNS ["Builtin"]) (UN "MkPair")))))
(IVar (UN "x"))))
(IVar (UN "y"))]
@MarcelineVQ
Copy link
Author

pairing : Applicative f => f a -> f b -> f (a,b)
pairing x y = %runElab check  (IApp fc
                                (IApp fc 
                                  (IVar fc (UN "<*>"))
                                  (IApp fc
                                    (IApp fc
                                      (IVar fc (UN "<*>"))
                                      (IApp fc
                                        (IVar fc (UN "pure"))
                                        (IAlternative fc (UniqueDefault (IVar fc (NS (MkNS ["Builtin"]) (UN "MkPair"))))
                                           [(IVar fc (NS (MkNS ["Builtin"]) (UN "MkPair"))), (IVar fc (NS (MkNS ["Builtin"]) (UN "Pair")))])))
                                    (IVar fc (UN "x"))))
                                (IVar fc (UN "y")))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment