1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
module ICurry.Extended.Files where
import FileGoodies
import FilePath
import System.CurryPath
import ICurry.Extended.Types
import ICurry.Files
lookupIECurryFile :: [String] -> String -> IO (Maybe String)
lookupIECurryFile paths modname =
lookupFileInPath base
[".iecy"]
(map ((</> dir) . addCurrySubdir) paths)
>>= normaliser
where
(dir, base) = splitDirectoryBaseName $ modNameToPath modname
getIECurryFile :: [String] -> String -> IO String
getIECurryFile = lookupToGet lookupIECurryFile
(error "Cannot find IECurry file")
readIECurry :: [String] -> String -> IO (IEProg)
readIECurry paths modname = do
fname <- getIECurryFile paths modname
contents <- readFile fname
return $ read contents
writeIECurry :: [String] -> String -> IEProg -> IO ()
writeIECurry paths modname prog = do
filename <- getPathForModule paths modname >>= return . (<.> "iecy")
writeFile filename $ show prog
|