Utils.hs 675 Bytes
Newer Older
1
{-|
2
Module      : Gargantext.API.Admin.Utils
3 4 5 6 7 8 9 10 11 12 13 14
Description : Server API main Types
Copyright   : (c) CNRS, 2017-Present
License     : BSD3
Maintainer  : team@gargantext.org
Stability   : experimental
Portability : POSIX

Mainly copied from Servant.Job.Utils (Thanks)

-}


15
module Gargantext.API.Admin.Utils
16 17
  where

18
import Data.Maybe (fromMaybe)
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
import Gargantext.Prelude
import Prelude (String)
import qualified Data.Text as T

infixr 4 ?|

-- Reverse infix form of "fromMaybe"
(?|) :: Maybe a -> a -> a
(?|) = flip fromMaybe

infixr 4 ?!

-- Reverse infix form of "fromJust" with a custom error message
(?!) :: Maybe a -> String -> a
(?!) ma' msg = ma' ?| panic (T.pack msg)