From e1b730fcfe9ba724d52a8574ceabb4ee7d491284 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 4 Apr 2000 02:20:30 +0000 Subject: [PATCH 1/1] [project @ 2000-04-04 02:20:30 by andy] Using the new Prelude structure to handle prims. --- ghc/lib/hugs/PrimPrel.hs | 37 ++++++++++++++++++++++++++++++++++ ghc/lib/std/Array.lhs | 17 ++++++++-------- ghc/lib/std/CPUTime.lhs | 9 ++++----- ghc/lib/std/IO.lhs | 49 ++++++++++++++++++++++------------------------ ghc/lib/std/Random.lhs | 3 +-- ghc/lib/std/System.lhs | 31 ++++++++++++++--------------- 6 files changed, 88 insertions(+), 58 deletions(-) diff --git a/ghc/lib/hugs/PrimPrel.hs b/ghc/lib/hugs/PrimPrel.hs index 16f2ca0..d2190d3 100644 --- a/ghc/lib/hugs/PrimPrel.hs +++ b/ghc/lib/hugs/PrimPrel.hs @@ -102,6 +102,43 @@ module PrimPrel ( asTypeOf, error, undefined, seq, ($!) -- Now we have the extra (non standard) thing. + + , IORef + , PrimArray + , copy_String_to_cstring + , newIORef + , nh_close + , nh_errno + , nh_exitwith + , nh_filesize + , nh_flush + , nh_free + , nh_getCPUprec + , nh_getCPUtime + , nh_getPID + , nh_iseof + , nh_open + , nh_read + , nh_stderr + , nh_stdin + , nh_stdout + , nh_system + , nh_write + , nullAddr + , prelCleanupAfterRunAction + , primGetEnv + , primGetRawArgs + , primIndexArray + , primIntToChar + , primNewArray + , primReadArray + , primUnsafeFreezeArray + , primWriteArray + , primWriteCharOffAddr + , readIORef + , runST + , unsafePerformIO + , writeIORef ) where -- Standard value bindings {Prelude} ---------------------------------------- diff --git a/ghc/lib/std/Array.lhs b/ghc/lib/std/Array.lhs index 5ee94ff..cb77fe3 100644 --- a/ghc/lib/std/Array.lhs +++ b/ghc/lib/std/Array.lhs @@ -45,15 +45,14 @@ import PrelShow import PrelArr -- Most of the hard work is done here import PrelBase #else -import Prelude -import privileged Prelude ( PrimArray - , runST - , primNewArray - , primWriteArray - , primReadArray - , primUnsafeFreezeArray - , primIndexArray - ) +import PrimPrel ( PrimArray + , runST + , primNewArray + , primWriteArray + , primReadArray + , primUnsafeFreezeArray + , primIndexArray + ) import Ix import List( (\\) ) #endif diff --git a/ghc/lib/std/CPUTime.lhs b/ghc/lib/std/CPUTime.lhs index f2aa415..a99e6b7 100644 --- a/ghc/lib/std/CPUTime.lhs +++ b/ghc/lib/std/CPUTime.lhs @@ -66,11 +66,10 @@ foreign import "libHS_cbits" "clockTicks" clockTicks :: IO Int #else \begin{code} -import Prelude -import privileged Prelude ( nh_getCPUtime - , nh_getCPUprec - , unsafePerformIO - ) +import PrimPrel ( nh_getCPUtime + , nh_getCPUprec + , unsafePerformIO + ) getCPUTime :: IO Integer getCPUTime diff --git a/ghc/lib/std/IO.lhs b/ghc/lib/std/IO.lhs index 7ddeb03..386d490 100644 --- a/ghc/lib/std/IO.lhs +++ b/ghc/lib/std/IO.lhs @@ -87,32 +87,29 @@ module IO ( #ifdef __HUGS__ import Ix(Ix) -import Prelude -import privileged Prelude ( IORef - , unsafePerformIO - , prelCleanupAfterRunAction - , copy_String_to_cstring - , primIntToChar - , primWriteCharOffAddr - , nullAddr - , newIORef - , writeIORef - , readIORef - , nh_close - , nh_errno - , nh_stdin - , nh_stdout - , nh_stderr - , nh_flush - , nh_open - , nh_free - , nh_read - , nh_write - , nh_filesize - , nh_iseof - ) - - +import PrimPrel ( IORef + , unsafePerformIO + , prelCleanupAfterRunAction + , copy_String_to_cstring + , primIntToChar + , primWriteCharOffAddr + , nullAddr + , newIORef + , writeIORef + , readIORef + , nh_close + , nh_errno + , nh_stdin + , nh_stdout + , nh_stderr + , nh_flush + , nh_open + , nh_free + , nh_read + , nh_write + , nh_filesize + , nh_iseof + ) #else --import PrelST import PrelBase diff --git a/ghc/lib/std/Random.lhs b/ghc/lib/std/Random.lhs index 4a2a88d..76a7277 100644 --- a/ghc/lib/std/Random.lhs +++ b/ghc/lib/std/Random.lhs @@ -39,8 +39,7 @@ import PrelReal ( toInt ) import PrelFloat ( float2Double, double2Float ) import Time ( getClockTime, ClockTime(..) ) #else -import privileged Prelude - ( IORef +import PrimPrel ( IORef , newIORef , readIORef , writeIORef diff --git a/ghc/lib/std/System.lhs b/ghc/lib/std/System.lhs index ab4f9d9..5550e6d 100644 --- a/ghc/lib/std/System.lhs +++ b/ghc/lib/std/System.lhs @@ -188,22 +188,21 @@ unpackProgName argv -- -- Suitable for use with Hugs 98 ----------------------------------------------------------------------------- -import Prelude -import privileged Prelude ( primGetRawArgs - , primGetEnv - , prelCleanupAfterRunAction - , copy_String_to_cstring - , readIORef - , nh_stderr - , nh_stdout - , nh_stdin - , nh_exitwith - , nh_flush - , nh_close - , nh_system - , nh_free - , nh_getPID - ) +import PrimPrel ( primGetRawArgs + , primGetEnv + , prelCleanupAfterRunAction + , copy_String_to_cstring + , readIORef + , nh_stderr + , nh_stdout + , nh_stdin + , nh_exitwith + , nh_flush + , nh_close + , nh_system + , nh_free + , nh_getPID + ) data ExitCode = ExitSuccess | ExitFailure Int -- 1.7.10.4