git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add HasCallStack to internalError (#2608)

* Add HasCallStack to internalError * Update CONTRIBUTORS.md * Update CONTRIBUTORS.md * Update CONTRIBUTORS.md

commit6277f69258418a8e5beff081daa0610fd4e4ac42 authorAlex Biehl <alexbiehl@gmail.com> dateMon 30 Jan 2017, 17:35 (10 years ago) parent090f185
2 files changed+28−11
CONTRIBUTORS.md+1 src/Language/PureScript/Crash.hs+27−11
CONTRIBUTORS.md+1
@@ -89,6 +89,7 @@ This file lists the contributors to the PureScript compiler project, and the ter
8989- [@RyanGlScott](https://github.com/RyanGlScott) (Ryan Scott) My existing contributions and all future contributions until further notice are Copyright Ryan Scott, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
9090- [@seungha-kim](https://github.com/seungha-kim) (Seungha Kim) My existing contributions and all future contributions until further notice are Copyright Seungha Kim, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
9191- [@matthewleon](https://github.com/matthewleon) (Matthew Leon) My existing contributions and all future contributions until further notice are Copyright Matthew Leon, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
92+- [@alexbiehl](https://github.com/alexbiehl) (Alexander Biehl) My existing contributions and all future contributions until further notice are Copyright Alexander Biehl, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
9293
9394### Companies
9495
src/Language/PureScript/Crash.hs+27−11
@@ -1,11 +1,27 @@
1−module Language.PureScript.Crash where
2−
3−import Prelude.Compat
4−
5−-- | Exit with an error message and a crash report link.
6−internalError :: String -> a
7−internalError =
8− error
9− . ("An internal error occurred during compilation: " ++)
10− . (++ "\nPlease report this at https://github.com/purescript/purescript/issues")
11− . show
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE ImplicitParams #-}
3+
4+module Language.PureScript.Crash where
5+
6+import Prelude.Compat
7+
8+import qualified GHC.Stack
9+
10+-- | A compatibility wrapper for the @GHC.Stack.HasCallStack@ constraint.
11+#if __GLASGOW_HASKELL__ >= 800
12+type HasCallStack = GHC.Stack.HasCallStack
13+#elif MIN_VERSION_GLASGOW_HASKELL(7,10,2,0)
14+type HasCallStack = (?callStack :: GHC.Stack.CallStack)
15+#else
16+import GHC.Exts (Constraint)
17+-- CallStack wasn't present in GHC 7.10.1
18+type HasCallStack = (() :: Constraint)
19+#endif
20+
21+-- | Exit with an error message and a crash report link.
22+internalError :: HasCallStack => String -> a
23+internalError =
24+ error
25+ . ("An internal error occurred during compilation: " ++)
26+ . (++ "\nPlease report this at https://github.com/purescript/purescript/issues")
27+ . show