Skip to content

Instantly share code, notes, and snippets.

@Lysxia
Last active Sep 20, 2022
Embed
What would you like to do?
Incoherence in gsolomap
{-# LANGUAGE DeriveGeneric #-}
module Main where
import Generic.Functor
import GHC.Generics (Generic)
data T a b = C Int a b
deriving (Show, Generic)
fmapT :: (b -> b') -> T a b -> T a b'
fmapT = gsolomap
firstT :: (a -> a') -> T a b -> T a' b
firstT = gsolomap
bothT :: (a -> a') -> T a a -> T a' a'
bothT = gsolomap
watT ::
(a -> a') ->
T (a , a ) ((a -> a') -> Maybe a ) ->
T (a', a') ((a' -> a ) -> Maybe a')
watT = gsolomap
main :: IO ()
main = do
print (fmapT ((+1) :: Int -> Int) (C 0 0 0 :: T Int Int))
print (gsolomap ((+1) :: Int -> Int) (C 0 0 0 :: T Int Int) :: T Int Int)
-- NB: Type annotations are needed on both the input and output T Int Int.
putStrLn "We are not the same."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment