summaryrefslogtreecommitdiff
path: root/Handler/Types.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-03-15 18:11:47 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2017-03-15 18:11:47 +0100
commit3cd4169e33c07b71129aafcecfb81a3b5007fa39 (patch)
tree261de0303273cc1a861977dc9aebce235d0afe51 /Handler/Types.hs
parent37f0dac79707a0de81ec6364d2704007eefd9289 (diff)
downloadbar-3cd4169e33c07b71129aafcecfb81a3b5007fa39.tar
bar-3cd4169e33c07b71129aafcecfb81a3b5007fa39.tar.gz
bar-3cd4169e33c07b71129aafcecfb81a3b5007fa39.tar.bz2
bar-3cd4169e33c07b71129aafcecfb81a3b5007fa39.tar.xz
bar-3cd4169e33c07b71129aafcecfb81a3b5007fa39.zip
Autocomplete types
Diffstat (limited to 'Handler/Types.hs')
-rw-r--r--Handler/Types.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Handler/Types.hs b/Handler/Types.hs
new file mode 100644
index 0000000..04055ad
--- /dev/null
+++ b/Handler/Types.hs
@@ -0,0 +1,15 @@
1module Handler.Types where
2
3import Import
4
5import Data.Set (Set)
6import qualified Data.Set as Set
7
8getTypesR :: Handler Value
9getTypesR = returnJson <=< runDB $ do
10 Set.fromList . map (kindType . entityVal) <$> selectList [] []
11
12getTypeR :: Handler Value
13getTypeR = do
14 kind <- maybe (invalidArgs ["kind"]) return =<< lookupGetParam "kind"
15 returnJson <=< runDB $ kindType . entityVal <$> getBy404 (UniqueKind $ normalizeKind kind)