]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/API/Utils.hs
Merge branch 'dev' into dev-phylo
[gargantext.git] / src / Gargantext / API / Utils.hs
1 {-|
2 Module : Gargantext.API.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 {-# LANGUAGE OverloadedStrings #-}
15 {-# LANGUAGE NoImplicitPrelude #-}
16
17 module Gargantext.API.Utils
18 where
19
20 import Gargantext.Prelude
21 import Data.Maybe (Maybe, fromMaybe)
22 import Prelude (String)
23 import qualified Data.Text as T
24
25 infixr 4 ?|
26
27 -- Reverse infix form of "fromMaybe"
28 (?|) :: Maybe a -> a -> a
29 (?|) = flip fromMaybe
30
31 infixr 4 ?!
32
33 -- Reverse infix form of "fromJust" with a custom error message
34 (?!) :: Maybe a -> String -> a
35 (?!) ma' msg = ma' ?| panic (T.pack msg)