-
-
Save ocharles/853b7733d35eeaeeb7e2 to your computer and use it in GitHub Desktop.
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
testForm :: Monad m => Form Text m [Pokemon] | |
testForm = "pokemon" .: pokemon | |
where pokemon = listOf (Pokemon <$> "n" .: listOf ("x" .: stringRead "Read failure" Nothing)) | |
testForm :: Monad m => Form Text m [Pokemon] | |
testForm = "pokemon" .: pokemon | |
where pokemon = listOf (Pokemon <$> "n" .: listOf (stringRead "Read failure" Nothing) | |
blah :: IO (View Text, Maybe [Pokemon]) | |
blah = postForm "form-name" testForm pokeEnv | |
where | |
pokeEnv (ActualPath p) = case p of | |
["form-name", "pokemon", Index 0, "name"] -> return [TextInput "5"] | |
["form-name", "pokemon", Index 0, "n", Index 0, "x"] -> return [TextInput "1"] | |
["form-name", "pokemon", Index 0, "n", Index 1, "x"] -> return [TextInput "2"] | |
["form-name", "pokemon", Index 1, "name"] -> return [TextInput "3"] | |
["form-name", "pokemon", Index 1, "n", Index 0, "x"] -> return [TextInput "3"] | |
_ -> return [] | |
pokeEnv (MetaPath p) = case p of | |
["form-name", "pokemon"] -> return [Container 2] | |
["form-name", "pokemon", Index 0, "n"] -> return [Container 2] | |
["form-name", "pokemon", Index 1, "n"] -> return [Container 1] | |
_ -> return [] | |
λ> fmap snd blah | |
Just [Pokemon [1,2],Pokemon [3]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment