summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/src/Minilang/API.hs
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud@pankzsoft.com>2025-11-04 08:09:35 +0100
committerArnaud Bailly <arnaud@pankzsoft.com>2025-11-04 08:09:35 +0100
commit51194425997225de7b7ca83e26b76b9a82f0e10d (patch)
tree7faf74f783ea4ddf2e08fe6be3b536e6e7a8500f /lambda-calcul/haskell/src/Minilang/API.hs
parent46d312450863eb8eb82fd8c33f7f80705de52cdb (diff)
downloadlambda-nantes-51194425997225de7b7ca83e26b76b9a82f0e10d.tar.gz
Scaffold RESTish API for challenge
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang/API.hs')
-rw-r--r--lambda-calcul/haskell/src/Minilang/API.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/lambda-calcul/haskell/src/Minilang/API.hs b/lambda-calcul/haskell/src/Minilang/API.hs
new file mode 100644
index 0000000..65e652a
--- /dev/null
+++ b/lambda-calcul/haskell/src/Minilang/API.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE DeriveAnyClass #-}
+
+module Minilang.API where
+
+import Data.Time (UTCTime)
+import Servant (Get, JSON, (:>))
+import GHC.Generics (Generic)
+import Data.Aeson (ToJSON, FromJSON)
+
+data Score = Score
+ { name :: String,
+ grade :: Int,
+ lastTest :: UTCTime
+ }
+ deriving (Eq, Show, Generic, ToJSON, FromJSON)
+
+type LambdaAPI = "api" :> "leaderboard" :> Get '[JSON] [Score]