Initial commit
This commit is contained in:
commit
c101616e62
309 changed files with 53937 additions and 0 deletions
46
bundled/Basement/Error.hs
Normal file
46
bundled/Basement/Error.hs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{-# LANGUAGE BangPatterns #-}
|
||||
{-# LANGUAGE DeriveDataTypeable #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
{-# LANGUAGE RebindableSyntax #-}
|
||||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE MagicHash #-}
|
||||
{-# LANGUAGE PolyKinds #-}
|
||||
{-# LANGUAGE ImplicitParams #-}
|
||||
{-# LANGUAGE ExistentialQuantification #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
#if __GLASGOW_HASKELL__ >= 800
|
||||
{-# LANGUAGE TypeInType #-}
|
||||
#endif
|
||||
module Basement.Error
|
||||
( error
|
||||
) where
|
||||
|
||||
import GHC.Prim
|
||||
import Basement.UTF8.Base
|
||||
import Basement.Compat.CallStack
|
||||
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
|
||||
import GHC.Types (RuntimeRep)
|
||||
import GHC.Exception (errorCallWithCallStackException)
|
||||
|
||||
-- | stop execution and displays an error message
|
||||
error :: forall (r :: RuntimeRep) . forall (a :: TYPE r) . HasCallStack => String -> a
|
||||
error s = raise# (errorCallWithCallStackException (sToList s) ?callstack)
|
||||
|
||||
#elif MIN_VERSION_base(4,7,0)
|
||||
|
||||
import GHC.Exception (errorCallException)
|
||||
|
||||
error :: String -> a
|
||||
error s = raise# (errorCallException (sToList s))
|
||||
|
||||
#else
|
||||
|
||||
import GHC.Types
|
||||
import GHC.Exception
|
||||
|
||||
error :: String -> a
|
||||
error s = throw (ErrorCall (sToList s))
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue