Created
October 8, 2013 07:30
-
-
Save NathanHowell/6880968 to your computer and use it in GitHub Desktop.
Convert a type to a nested tuple, preserving left-to-right ordering via CPS conversion.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DefaultSignatures #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import Data.Typeable | |
convert :: (Typeable t, Typeable b) => (forall a . Typeable a => a -> r) -> [t] -> b -> r | |
convert f (x:xs) b = convert f xs (x, b) | |
convert f [] b = f b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment