-- Hooks for primitives: -----------------------------------------------------
-- Do not mess with these!
--- Anything named hugsprim needs to also be available in combined mode,
--- so any such function is also present in ghc/lib/std/PrelHugs.lhs.
-
primCompAux :: Ord a => a -> a -> Ordering -> Ordering
primCompAux x y o = case compare x y of EQ -> o; LT -> LT; GT -> GT
primPmDouble :: Fractional a => Double -> a -> Bool
primPmDouble n x = fromDouble n == x
+-- ToDo: make the message more informative.
+primPmFail :: a
+primPmFail = error "Pattern Match Failure"
+
+-- used in desugaring Foreign functions
+hugsprimMkIO :: (RealWorld -> (a,RealWorld)) -> IO a
+hugsprimMkIO = ST
+
+hugsprimCreateAdjThunk :: (a -> b) -> String -> Char -> IO Addr
+hugsprimCreateAdjThunk fun typestr callconv
+ = do sp <- makeStablePtr fun
+ p <- copy_String_to_cstring typestr -- is never freed
+ a <- primCreateAdjThunkARCH sp p callconv
+ return a
+
-- The following primitives are only needed if (n+k) patterns are enabled:
hugsprimPmSub :: Integral a => Int -> a -> a
hugsprimPmSub n x = x - fromInt n
hugsprimPmLe :: Integral a => a -> a -> Bool
hugsprimPmLe x y = x <= y
--- ToDo: make the message more informative.
-primPmFail :: a
-primPmFail = error "Pattern Match Failure"
-
--- used in desugaring Foreign functions
-primMkIO :: (RealWorld -> (a,RealWorld)) -> IO a
-primMkIO = ST
-
-primCreateAdjThunk :: (a -> b) -> String -> Char -> IO Addr
-primCreateAdjThunk fun typestr callconv
- = do sp <- makeStablePtr fun
- p <- copy_String_to_cstring typestr -- is never freed
- a <- primCreateAdjThunkARCH sp p callconv
- return a
-
-- Unpack strings generated by the Hugs code generator.
-- Strings can contain \0 provided they're coded right.
--