Maybe you want a deconstructor (sometime called an eliminator)? deconsVar :: (Maybe Int -> a) -> (Maybe String -> a) -> Var -> a deconsVar f g (V1 a) = f a deconsVar f g (V2 b) = g b