Skip to content

Instantly share code, notes, and snippets.

@LSLeary
Created September 14, 2026 11:52
Show Gist options
  • Select an option

  • Save LSLeary/304d5b06d88b99c19752be6bc36679b2 to your computer and use it in GitHub Desktop.

Select an option

Save LSLeary/304d5b06d88b99c19752be6bc36679b2 to your computer and use it in GitHub Desktop.
Type annotated composition arrows!
{-# LANGUAGE RequiredTypeArguments #-}
module AnnotatedArrows (
(<--<), (>--),
(--<), (>-->),
) where
infixr 9 <--<, >--
(<--<) :: (b -> c) -> (a -> b) -> a -> c
(<--<) = (.)
(>--) :: forall b -> (a -> b) -> a -> b
_ >-- f = f
_test_l :: Bool -> Int
_test_l = (*2) <--<Int>-- fromEnum <--<Bool>-- not
infixr 9 --<, >-->
(--<) :: (a -> b) -> (b -> c) -> a -> c
(--<) = flip (.)
(>-->) :: forall a -> (a -> b) -> (a -> b)
_ >--> g = g
_test_r :: Int -> Bool
_test_r = (*2) --<Int>--> toEnum --<Bool>--> not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment