@@ -45,7 +45,6 @@ module Text.Pandoc.Free ( PandocActionF(..)
45 , getDefaultReferenceODT
45 , getDefaultReferenceODT
46 , newStdGen
46 , newStdGen
47 , newUniqueHash
47 , newUniqueHash
49 , readFileStrict
48 , readFileStrict
50 , readFileLazy
49 , readFileLazy
51 , readFileUTF8
50 , readFileUTF8
@@ -81,8 +80,6 @@ import qualified Data.ByteString.Lazy as BL
81import Control.Monad.Free
80import Control.Monad.Free
82import qualified Control.Exception as E
81import qualified Control.Exception as E
83import qualified System.Environment as IO (lookupEnv)
82import qualified System.Environment as IO (lookupEnv)
84−import Text.Pandoc.UUID
85−import qualified Text.Pandoc.UUID as IO (getRandomUUID)
86import qualified Text.Pandoc.UTF8 as UTF8 (readFile, toString)
83import qualified Text.Pandoc.UTF8 as UTF8 (readFile, toString)
87import System.FilePath.Glob (match, compile)
84import System.FilePath.Glob (match, compile)
88import System.FilePath ((</>))
85import System.FilePath ((</>))
@@ -100,7 +97,6 @@ data PandocActionF nxt =
100 | GetDefaultReferenceODT (Maybe FilePath) (Archive -> nxt)
97 | GetDefaultReferenceODT (Maybe FilePath) (Archive -> nxt)
101 | NewStdGen (StdGen -> nxt)
98 | NewStdGen (StdGen -> nxt)
102 | NewUniqueHash (Int -> nxt)
99 | NewUniqueHash (Int -> nxt)
103− | NewUUID (UUID -> nxt)
104 | ReadFileStrict FilePath (B.ByteString -> nxt)
100 | ReadFileStrict FilePath (B.ByteString -> nxt)
105 | ReadFileLazy FilePath (BL.ByteString -> nxt)
101 | ReadFileLazy FilePath (BL.ByteString -> nxt)
106 | ReadFileUTF8 FilePath (String -> nxt)
102 | ReadFileUTF8 FilePath (String -> nxt)
@@ -137,9 +133,6 @@ newStdGen = liftF $ NewStdGen id
137newUniqueHash :: PandocAction Int
133newUniqueHash :: PandocAction Int
138newUniqueHash = liftF $ NewUniqueHash id
134newUniqueHash = liftF $ NewUniqueHash id
140−newUUID :: PandocAction UUID
141−newUUID = liftF $ NewUUID id
143readFileStrict :: FilePath -> PandocAction B.ByteString
136readFileStrict :: FilePath -> PandocAction B.ByteString
144readFileStrict fp = liftF $ ReadFileStrict fp id
137readFileStrict fp = liftF $ ReadFileStrict fp id
@@ -183,7 +176,6 @@ runIO (Free (GetDefaultReferenceODT mfp f)) =
183 IO.getDefaultReferenceODT mfp >>= runIO . f
176 IO.getDefaultReferenceODT mfp >>= runIO . f
184runIO (Free (NewStdGen f)) = IO.newStdGen >>= runIO . f
177runIO (Free (NewStdGen f)) = IO.newStdGen >>= runIO . f
185runIO (Free (NewUniqueHash f)) = hashUnique <$> IO.newUnique >>= runIO . f
178runIO (Free (NewUniqueHash f)) = hashUnique <$> IO.newUnique >>= runIO . f
186−runIO (Free (NewUUID f)) = IO.getRandomUUID >>= runIO . f
187runIO (Free (ReadFileStrict fp f)) = B.readFile fp >>= runIO . f
179runIO (Free (ReadFileStrict fp f)) = B.readFile fp >>= runIO . f
188runIO (Free (ReadFileLazy fp f)) = BL.readFile fp >>= runIO . f
180runIO (Free (ReadFileLazy fp f)) = BL.readFile fp >>= runIO . f
189runIO (Free (ReadFileUTF8 fp f)) = UTF8.readFile fp >>= runIO . f
181runIO (Free (ReadFileUTF8 fp f)) = UTF8.readFile fp >>= runIO . f
@@ -250,14 +242,6 @@ runTest (Free (NewUniqueHash f)) = do
250 modify $ \st -> st { stUniqStore = us }
242 modify $ \st -> st { stUniqStore = us }
251 return u >>= runTest . f
243 return u >>= runTest . f
252 _ -> M.fail "uniq store ran out of elements"
244 _ -> M.fail "uniq store ran out of elements"
253−runTest (Free (NewUUID f)) = do
254− word8s <- gets stWord8Store
256− -- note we use f' because f is a param of the function
257− a:b:c:d:e:f':g:h:i:j:k:l:m:n:o:p:remaining -> do
258− modify $ \st -> st { stWord8Store = remaining }
259− return (UUID a b c d e f' g h i j k l m n o p) >>= runTest . f
260− _ -> M.fail "word8 supply was not infinite"
261runTest (Free (ReadFileStrict fp f)) = do
245runTest (Free (ReadFileStrict fp f)) = do
262 fps <- asks envFiles
246 fps <- asks envFiles
263 case lookup fp fps of
247 case lookup fp fps of