Last active
January 19, 2019 17:17
-
-
Save JBetz/7b0b374bf022b94db2730b5f05b057fd to your computer and use it in GitHub Desktop.
type list iteration example
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
generate :: [e] -> [Structure e] | |
generate objs = | |
let (otStrs, objs2) = generateFrom @OT objs | |
(ttStrs, objs3) = generateFrom @TT objs2 | |
(btStrs, objs4) = generateFrom @BT objs3 | |
(lStrs, _) = generateFrom @L objs4 | |
in otStrs ++ ttStrs ++ btStrs ++ lStrs | |
-- first element of the tuple is all the structures that could be generated from the given list of objects | |
-- second element is all the objects that remain, i.e., that weren't used to generate one of the structures | |
generateFrom :: forall f. Generatable f => [e] -> ([Structure e], [e]) | |
generateFrom objs = ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment