2 module Java.ClassPath.Types where
4 import Control.Monad.State
11 Directory FilePath [Tree a]
15 instance Show a => Show (Tree a) where
16 show (Directory dir forest) = dir ++ "/{" ++ intercalate ", " (map show forest) ++ "}"
17 show (File a) = show a
21 NotLoaded FilePath -- ^ Not loaded .class file
22 | Loaded FilePath (Class Direct) -- ^ Class loaded from .class file
23 | NotLoadedJAR FilePath FilePath -- ^ Not loaded .jar file
24 | LoadedJAR FilePath (Class Direct) -- ^ Class loaded from .jar file
27 instance Show CPEntry where
28 show (NotLoaded path) = "<Not loaded file: " ++ path ++ ">"
29 show (Loaded path cls) = "<Loaded from " ++ path ++ ": " ++ toString (thisClass cls) ++ ">"
30 show (NotLoadedJAR jar path) = "<Not loaded JAR: " ++ jar ++ ": " ++ path ++ ">"
31 show (LoadedJAR path cls) = "<Read JAR: " ++ path ++ ": " ++ toString (thisClass cls) ++ ">"
34 type ClassPath a = StateT [Tree CPEntry] IO a