]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/API/Admin/Utils.hs
Merge remote-tracking branch 'origin/571-dev-node-corpus-api-search-fixes' into dev...
[gargantext.git] / src / Gargantext / API / Admin / Utils.hs
1 {-|
2 Module : Gargantext.API.Admin.Utils
3 Description : Server API main Types
4 Copyright : (c) CNRS, 2017-Present
5 License : BSD3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Mainly copied from Servant.Job.Utils (Thanks)
11
12 -}
13
14
15 module Gargantext.API.Admin.Utils
16 where
17
18 import Data.Maybe (fromMaybe)
19 import Gargantext.Prelude
20 import Prelude (String)
21 import qualified Data.Text as T
22
23 infixr 4 ?|
24
25 -- Reverse infix form of "fromMaybe"
26 (?|) :: Maybe a -> a -> a
27 (?|) = flip fromMaybe
28
29 infixr 4 ?!
30
31 -- Reverse infix form of "fromJust" with a custom error message
32 (?!) :: Maybe a -> String -> a
33 (?!) ma' msg = ma' ?| panic (T.pack msg)