module Handler.Types where import Import import Data.Set (Set) import qualified Data.Set as Set getTypesR :: Handler Value getTypesR = returnJson <=< runDB $ do Set.fromList . map (kindType . entityVal) <$> selectList [] [] getTypeR :: Handler Value getTypeR = do kind <- maybe (invalidArgs ["kind"]) return =<< lookupGetParam "kind" returnJson <=< runDB $ kindType . entityVal <$> getBy404 (UniqueKind $ normalizeKind kind)