{-# OPTIONS -#include <sys/stat.h> -#include <dirent.h> -#include "cbits/stgio.h" #-}
module Directory
(
- Permissions(Permissions,readable,writable,executable,searchable)
+ Permissions -- abstract
+
+ , readable -- :: Permissions -> Bool
+ , writable -- :: Permissions -> Bool
+ , executable -- :: Permissions -> Bool
+ , searchable -- :: Permissions -> Bool
, createDirectory -- :: FilePath -> IO ()
, removeDirectory -- :: FilePath -> IO ()
%*********************************************************
\begin{code}
-class ({-Show a,-} Ord a) => Ix a where
+class (Ord a) => Ix a where
range :: (a,a) -> [a]
index :: (a,a) -> a -> Int
inRange :: (a,a) -> a -> Bool
\begin{code}
instance Ix Char where
- range (c,c')
- | c <= c' = [c..c']
+ range (m,n)
+ | m <= n = [m..n]
| otherwise = []
- index b@(c,_) ci
- | inRange b ci = fromEnum ci - fromEnum c
- | otherwise = indexError ci b "Char"
+ index b@(m,_) i
+ | inRange b i = fromEnum i - fromEnum m
+ | otherwise = indexError i b "Char"
inRange (m,n) i = m <= i && i <= n
instance Ix Int where
- range (m,n)
+ range (m,n)
| m <= n = [m..n]
| otherwise = []
index b@(m,_) i
case (new_array_thing s) of { (# s#, arr@(MutableArray _ arr#) #) ->
let
fill_in s1# [] = s1#
- fill_in s1# ((i,v):is) =
+ fill_in s1# ((i,v) : is) =
case (index ixs i) of { I# n# ->
case writeArray# arr# n# v s1# of { s2# ->
fill_in s2# is }}
enumFrom (C# c) = efttCh (ord# c) 1# (># 255#)
enumFromTo (C# c1) (C# c2)
| c1 `leChar#` c2 = efttCh (ord# c1) 1# (># (ord# c2))
- | otherwise = efttCh (ord# c1) (negateInt# 1#) (<# (ord# c2))
+ | otherwise = []
enumFromThen (C# c1) (C# c2)
| c1 `leChar#` c2 = efttCh (ord# c1) (ord# c2 -# ord# c1) (># 255#)
enumFrom (I# c) = efttInt True c 1# (\ _ -> False)
enumFromTo (I# c1) (I# c2)
- | c1 <# c2 = efttInt True c1 1# (># c2)
- | otherwise = efttInt False c1 (negateInt# 1#) (<# c2)
+ | c1 <=# c2 = efttInt True c1 1# (># c2)
+ | otherwise = []
enumFromThen (I# c1) (I# c2)
| c1 <# c2 = efttInt True c1 (c2 -# c1) (\ _ -> False)
-- for PrelException.hi.
---------------------------------------------------------------------------
-__interface PrelErr 1 where
+__interface PrelException 1 where
__export ! PrelException ioError catch;
1 ioError :: __forall [a] => PrelIOBase.IOError -> PrelIOBase.IO a ;
1 catch :: __forall [a] => PrelIOBase.IO a -> (PrelIOBase.IOError -> PrelIOBase.IO a) -> PrelIOBase.IO a ;
where en' a b = a : en' (a + b) b
enumFromTo n m
| n <= m = takeWhile (<= m) (enumFrom n)
- | otherwise = takeWhile (>= m) (enumFromThen n (n-1))
+ | otherwise = []
enumFromThenTo n m p = takeWhile pred (enumFromThen n m)
where
pred | m >= n = (<= p)
toEnum = fromIntegral
fromEnum = fromInteger . truncate -- may overflow
enumFrom = numericEnumFrom
+ enumFromTo = numericEnumFromTo
enumFromThen = numericEnumFromThen
enumFromThenTo = numericEnumFromThenTo
Either(..),
Ordering(..),
Char, String, Int, Integer, Float, Double, IO,
- Ratio, Rational,
+ Rational,
[]((:), []),
module PrelTup,