-
-
Save paulcc/3018839 to your computer and use it in GitHub Desktop.
pseudo-haskell
This file contains hidden or 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
class Valid a where | |
valid :: a -> OkF Errors | |
class Valid a => Persist m a where | |
save :: a -> m (OkF a) -- or errors | |
data User = User {name :: String} | |
data Organisation = Organisation {name :: String, users :: [User]} | |
class Url r | |
show :: r -> Url | |
edit :: r -> Url | |
list :: [r] -> Url -- ? | |
instance Restful r => Url r where ... | |
-- yank constrs out? | |
-- responsibility: marshall, save, redirect | |
-- constr can be (\n -> Org n u), closure | |
create_ constr args | |
= do | |
res <- save (constr args) | |
case res of | |
Ok r -> redirect (show r) | |
Fail "oops" -> render template | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment