Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Created August 4, 2021 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-martin/f765009680663c6b446239419ebe254d to your computer and use it in GitHub Desktop.
Save chris-martin/f765009680663c6b446239419ebe254d to your computer and use it in GitHub Desktop.
{-# language FlexibleContexts, FlexibleInstances, FunctionalDependencies #-}
module Idea where
class ComposeApply a b c | a b -> c where
(#) :: a -> b -> c
instance ComposeApply (a -> b) a b where
f # x = f x
instance ComposeApply (b -> c) (a -> b) (a -> c) where
f # g = \x -> f # (g # x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment