2 Module : Gargantext.API.Utils
3 Description : Server API main Types
4 Copyright : (c) CNRS, 2017-Present
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Mainly copied from Servant.Job.Utils (Thanks)
14 {-# LANGUAGE OverloadedStrings #-}
15 {-# LANGUAGE NoImplicitPrelude #-}
17 module Gargantext.API.Utils
20 import Gargantext.Prelude
21 import Data.Maybe (Maybe, fromMaybe)
22 import Prelude (String)
23 import qualified Data.Text as T
27 -- Reverse infix form of "fromMaybe"
28 (?|) :: Maybe a -> a -> a
33 -- Reverse infix form of "fromJust" with a custom error message
34 (?!) :: Maybe a -> String -> a
35 (?!) ma' msg = ma' ?| panic (T.pack msg)