]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/API/Admin/Utils.hs
[GRAPH] Distances fun with Accelerate (linear algebra in practice) (WIP)
[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 Gargantext.Prelude
19 import Data.Maybe (Maybe, fromMaybe)
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)