h,Dm       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                                                                                                                                                   "(c) The University of Glasgow 2015/BSD-style (see the file libraries/base/LICENSE)libraries@haskell.org experimentalportableSafeD Safeq  (c) Neil Mitchell 2005-2014BSD3ndmitchell@gmail.comstableportable Safe-Inferredo9 *Is the operating system Unix or Linux like $Is the operating system Windows like The character that separates directories. In the case where more than one character is possible,   is the 'ideal' one. Windows: pathSeparator == '\\' Posix: pathSeparator == '/' isPathSeparator pathSeparator $The list of all possible separators. Windows: pathSeparators == ['\\', '/'] Posix: pathSeparators == ['/'] pathSeparator `elem` pathSeparators Rather than using (==  )5, use this. Test if something is a path separator. .isPathSeparator a == (a `elem` pathSeparators) The character that is used to separate the entries in the $PATH environment variable. Windows: searchPathSeparator == ';' Posix: searchPathSeparator == ':' "Is the character a file separator? 5isSearchPathSeparator a == (a == searchPathSeparator) File extension character extSeparator == '.' (Is the character an extension character? 'isExtSeparator a == (a == extSeparator) Take a string, split it on the   character. Blank items are ignored on Windows, and converted to .> on Posix. On Windows path elements are stripped of quotes."Follows the recommendations in http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html Posix: splitSearchPath "File1:File2:File3" == ["File1","File2","File3"] Posix: splitSearchPath "File1::File2:File3" == ["File1",".","File2","File3"] Windows: splitSearchPath "File1;File2;File3" == ["File1","File2","File3"] Windows: splitSearchPath "File1;;File2;File3" == ["File1","File2","File3"] Windows: splitSearchPath "File1;\"File2\";File3" == ["File1","File2","File3"] Get a list of  s in the $PATH variable. Split on the extension.   is the inverse. splitExtension "/directory/path.ext" == ("/directory/path",".ext") uncurry (++) (splitExtension x) == x Valid x => uncurry addExtension (splitExtension x) == x splitExtension "file.txt" == ("file",".txt") splitExtension "file" == ("file","") splitExtension "file/file.txt" == ("file/file",".txt") splitExtension "file.txt/boris" == ("file.txt/boris","") splitExtension "file.txt/boris.ext" == ("file.txt/boris",".ext") splitExtension "file/path.txt.bob.fred" == ("file/path.txt.bob",".fred") splitExtension "file/path.txt/" == ("file/path.txt/","") %Get the extension of a file, returns "" for no extension, .ext otherwise. takeExtension "/directory/path.ext" == ".ext" takeExtension x == snd (splitExtension x) Valid x => takeExtension (addExtension x "ext") == ".ext" Valid x => takeExtension (replaceExtension x "ext") == ".ext"  "ext" == "/directory/path.ext" "/directory/path.txt" -<.> ".ext" == "/directory/path.ext" "foo.o" -<.> "c" == "foo.c" Set the extension of a file, overwriting one if already present, equivalent to  . replaceExtension "/directory/path.txt" "ext" == "/directory/path.ext" replaceExtension "/directory/path.txt" ".ext" == "/directory/path.ext" replaceExtension "file.txt" ".bob" == "file.bob" replaceExtension "file.txt" "bob" == "file.bob" replaceExtension "file" ".bob" == "file.bob" replaceExtension "file.txt" "" == "file" replaceExtension "file.fred.bob" "txt" == "file.fred.txt" replaceExtension x y == addExtension (dropExtension x) y Add an extension, even if there is already one there, equivalent to  . "/directory/path" <.> "ext" == "/directory/path.ext" "/directory/path" <.> ".ext" == "/directory/path.ext" 0Remove last extension, and the "." preceding it. dropExtension "/directory/path.ext" == "/directory/path" dropExtension x == fst (splitExtension x) Add an extension, even if there is already one there, equivalent to  . addExtension "/directory/path" "ext" == "/directory/path.ext" addExtension "file.txt" "bib" == "file.txt.bib" addExtension "file." ".bib" == "file..bib" addExtension "file" ".bib" == "file.bib" addExtension "/" "x" == "/.x" addExtension x "" == x Valid x => takeFileName (addExtension (addTrailingPathSeparator x) "ext") == ".ext" Windows: addExtension "\\\\share" ".txt" == "\\\\share\\.txt" *Does the given filename have an extension? hasExtension "/directory/path.ext" == True hasExtension "/directory/path" == False null (takeExtension x) == not (hasExtension x) 5Does the given filename have the specified extension? "png" `isExtensionOf` "/directory/file.png" == True ".png" `isExtensionOf` "/directory/file.png" == True ".tar.gz" `isExtensionOf` "bar/foo.tar.gz" == True "ar.gz" `isExtensionOf` "bar/foo.tar.gz" == False "png" `isExtensionOf` "/directory/file.png.jpg" == False "csv/table.csv" `isExtensionOf` "/data/csv/table.csv" == False 2Drop the given extension from a FilePath, and the "." preceding it. Returns  : if the FilePath does not have the given extension, or  . and the part before the extension if it does.+This function can be more predictable than  5, especially if the filename might itself contain . characters. stripExtension "hs.o" "foo.x.hs.o" == Just "foo.x" stripExtension "hi.o" "foo.x.hs.o" == Nothing dropExtension x == fromJust (stripExtension (takeExtension x) x) dropExtensions x == fromJust (stripExtension (takeExtensions x) x) stripExtension ".c.d" "a.b.c.d" == Just "a.b" stripExtension ".c.d" "a.b..c.d" == Just "a.b." stripExtension "baz" "foo.bar" == Nothing stripExtension "bar" "foobar" == Nothing stripExtension "" x == Just x Split on all extensions. splitExtensions "/directory/path.ext" == ("/directory/path",".ext") splitExtensions "file.tar.gz" == ("file",".tar.gz") uncurry (++) (splitExtensions x) == x Valid x => uncurry addExtension (splitExtensions x) == x splitExtensions "file.tar.gz" == ("file",".tar.gz") Drop all extensions. dropExtensions "/directory/path.ext" == "/directory/path" dropExtensions "file.tar.gz" == "file" not $ hasExtension $ dropExtensions x not $ any isExtSeparator $ takeFileName $ dropExtensions x Get all extensions. takeExtensions "/directory/path.ext" == ".ext" takeExtensions "file.tar.gz" == ".tar.gz" Replace all extensions of a file with a new extension. Note that   and   both work for adding multiple extensions, so only required when you need to drop all extensions first. replaceExtensions "file.fred.bob" "txt" == "file.txt" replaceExtensions "file.fred.bob" "tar.gz" == "file.tar.gz" Is the given character a valid drive letter? only a-z and A-Z are letters, not isAlpha which is more unicodey Split a path into a drive and a path. On Posix, / is a Drive. uncurry (++) (splitDrive x) == x Windows: splitDrive "file" == ("","file") Windows: splitDrive "c:/file" == ("c:/","file") Windows: splitDrive "c:\\file" == ("c:\\","file") Windows: splitDrive "\\\\shared\\test" == ("\\\\shared\\","test") Windows: splitDrive "\\\\shared" == ("\\\\shared","") Windows: splitDrive "\\\\?\\UNC\\shared\\file" == ("\\\\?\\UNC\\shared\\","file") Windows: splitDrive "\\\\?\\UNCshared\\file" == ("\\\\?\\","UNCshared\\file") Windows: splitDrive "\\\\?\\d:\\file" == ("\\\\?\\d:\\","file") Windows: splitDrive "/d" == ("","/d") Posix: splitDrive "/test" == ("/","test") Posix: splitDrive "//test" == ("//","test") Posix: splitDrive "test/file" == ("","test/file") Posix: splitDrive "file" == ("","file") &Join a drive and the rest of the path. Valid x => uncurry joinDrive (splitDrive x) == x Windows: joinDrive "C:" "foo" == "C:foo" Windows: joinDrive "C:\\" "bar" == "C:\\bar" Windows: joinDrive "\\\\share" "foo" == "\\\\share\\foo" Windows: joinDrive "/:" "foo" == "/:\\foo" Get the drive from a filepath. !takeDrive x == fst (splitDrive x) Delete the drive, if it exists. !dropDrive x == snd (splitDrive x) Does a path have a drive. not (hasDrive x) == null (takeDrive x) Posix: hasDrive "/foo" == True Windows: hasDrive "C:\\foo" == True Windows: hasDrive "C:foo" == True hasDrive "foo" == False hasDrive "" == False Is an element a drive Posix: isDrive "/" == True Posix: isDrive "/foo" == False Windows: isDrive "C:\\" == True Windows: isDrive "C:\\foo" == False isDrive "" == False *Split a filename into directory and file.   is the inverse. The first component will often end with a trailing slash. splitFileName "/directory/file.ext" == ("/directory/","file.ext") Valid x => uncurry () (splitFileName x) == x || fst (splitFileName x) == "./" Valid x => isValid (fst (splitFileName x)) splitFileName "file/bob.txt" == ("file/", "bob.txt") splitFileName "file/" == ("file/", "") splitFileName "bob" == ("./", "bob") Posix: splitFileName "/" == ("/","") Windows: splitFileName "c:" == ("c:","") Set the filename. replaceFileName "/directory/other.txt" "file.ext" == "/directory/file.ext" Valid x => replaceFileName x (takeFileName x) == x Drop the filename. Unlike  , this function will leave a trailing path separator on the directory. dropFileName "/directory/file.ext" == "/directory/" dropFileName x == fst (splitFileName x) Get the file name. takeFileName "/directory/file.ext" == "file.ext" takeFileName "test/" == "" takeFileName x `isSuffixOf` x takeFileName x == snd (splitFileName x) Valid x => takeFileName (replaceFileName x "fred") == "fred" Valid x => takeFileName (x "fred") == "fred" Valid x => isRelative (takeFileName x) 0Get the base name, without an extension or path. takeBaseName "/directory/file.ext" == "file" takeBaseName "file/test.txt" == "test" takeBaseName "dave.ext" == "dave" takeBaseName "" == "" takeBaseName "test" == "test" takeBaseName (addTrailingPathSeparator x) == "" takeBaseName "file/file.tar.gz" == "file.tar" Set the base name. replaceBaseName "/directory/other.ext" "file" == "/directory/file.ext" replaceBaseName "file/test.txt" "bob" == "file/bob.txt" replaceBaseName "fred" "bill" == "bill" replaceBaseName "/dave/fred/bob.gz.tar" "new" == "/dave/fred/new.tar" Valid x => replaceBaseName x (takeBaseName x) == x Is an item either a directory or the last character a path separator? hasTrailingPathSeparator "test" == False hasTrailingPathSeparator "test/" == True Add a trailing file path separator if one is not already present. hasTrailingPathSeparator (addTrailingPathSeparator x) hasTrailingPathSeparator x ==> addTrailingPathSeparator x == x Posix: addTrailingPathSeparator "test/rest" == "test/rest/" #Remove any trailing path separators dropTrailingPathSeparator "file/test/" == "file/test" dropTrailingPathSeparator "/" == "/" Windows: dropTrailingPathSeparator "\\" == "\\" Posix: not (hasTrailingPathSeparator (dropTrailingPathSeparator x)) || isDrive x *Get the directory name, move up one level.  takeDirectory "/directory/other.ext" == "/directory" takeDirectory x `isPrefixOf` x || takeDirectory x == "." takeDirectory "foo" == "." takeDirectory "/" == "/" takeDirectory "/foo" == "/" takeDirectory "/foo/bar/baz" == "/foo/bar" takeDirectory "/foo/bar/baz/" == "/foo/bar/baz" takeDirectory "foo/bar/baz" == "foo/bar" Windows: takeDirectory "foo\\bar" == "foo" Windows: takeDirectory "foo\\bar\\\\" == "foo\\bar" Windows: takeDirectory "C:\\" == "C:\\" 1Set the directory, keeping the filename the same. replaceDirectory "root/file.ext" "/directory/" == "/directory/file.ext" Valid x => replaceDirectory x (takeDirectory x) `equalFilePath` x  An alias for  . 0Combine two paths, assuming rhs is NOT absolute. Combine two paths with a path separator. If the second path starts with a path separator or a drive letter, then it returns the second. The intention is that readFile (dir   file)! will access the same file as &setCurrentDirectory dir; readFile file. Posix: "/directory" "file.ext" == "/directory/file.ext" Windows: "/directory" "file.ext" == "/directory\\file.ext" "directory" "/file.ext" == "/file.ext" Valid x => (takeDirectory x takeFileName x) `equalFilePath` x Combined: Posix: "/" "test" == "/test" Posix: "home" "bob" == "home/bob" Posix: "x:" "foo" == "x:/foo" Windows: "C:\\foo" "bar" == "C:\\foo\\bar" Windows: "home" "bob" == "home\\bob" Not combined: Posix: "home" "/bob" == "/bob" Windows: "home" "C:\\bob" == "C:\\bob"Not combined (tricky):On Windows, if a filepath starts with a single slash, it is relative to the root of the current drive. In [1], this is (confusingly) referred to as an absolute path. The current behavior of  ! is to never combine these forms. Windows: "home" "/bob" == "/bob" Windows: "home" "\\bob" == "\\bob" Windows: "C:\\home" "\\bob" == "\\bob"On Windows, from [1]: "If a file name begins with only a disk designator but not the backslash after the colon, it is interpreted as a relative path to the current directory on the drive with the specified letter." The current behavior of  ! is to never combine these forms. Windows: "D:\\foo" "C:bar" == "C:bar" Windows: "C:\\foo" "C:bar" == "C:bar" (Split a path by the directory separator. splitPath "/directory/file.ext" == ["/","directory/","file.ext"] concat (splitPath x) == x splitPath "test//item/" == ["test//","item/"] splitPath "test/item/file" == ["test/","item/","file"] splitPath "" == [] Windows: splitPath "c:\\test\\path" == ["c:\\","test\\","path"] Posix: splitPath "/file/test" == ["/","file/","test"] Just as  5, but don't add the trailing slashes to each element.  splitDirectories "/directory/file.ext" == ["/","directory","file.ext"] splitDirectories "test/file" == ["test","file"] splitDirectories "/test/file" == ["/","test","file"] Windows: splitDirectories "C:\\test\\file" == ["C:\\", "test", "file"] Valid x => joinPath (splitDirectories x) `equalFilePath` x splitDirectories "" == [] Windows: splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"] splitDirectories "/test///file" == ["/","test","file"] !Join path elements back together. joinPath a == foldr () "" a joinPath ["/","directory/","file.ext"] == "/directory/file.ext" Valid x => joinPath (splitPath x) == x joinPath [] == "" Posix: joinPath ["test","file","path"] == "test/file/path" Equality of two  s. If you call !System.Directory.canonicalizePath first this has a much better chance of working. Note that this doesn't follow symlinks or DOSNAM~1s. Similar to  , this does not expand "..", because of symlinks.  x == y ==> equalFilePath x y normalise x == normalise y ==> equalFilePath x y equalFilePath "foo" "foo/" not (equalFilePath "/a/../c" "/c") not (equalFilePath "foo" "/foo") Posix: not (equalFilePath "foo" "FOO") Windows: equalFilePath "foo" "FOO" Windows: not (equalFilePath "C:" "C:/") Contract a filename, based on a relative path. Note that the resulting path will never introduce ..* paths, as the presence of symlinks means ../b may not reach a/b if it starts from a/c. For a worked example see  http://neilmitchell.blogspot.co.uk/2015/10/filepaths-are-subtle-symlinks-are-hard.htmlthis blog post.The corresponding  makeAbsolute function can be found in System.Directory.  makeRelative "/directory" "/directory/file.ext" == "file.ext" Valid x => makeRelative (takeDirectory x) x `equalFilePath` takeFileName x makeRelative x x == "." Valid x y => equalFilePath x y || (isRelative x && makeRelative y x == x) || equalFilePath (y makeRelative y x) x Windows: makeRelative "C:\\Home" "c:\\home\\bob" == "bob" Windows: makeRelative "C:\\Home" "c:/home/bob" == "bob" Windows: makeRelative "C:\\Home" "D:\\Home\\Bob" == "D:\\Home\\Bob" Windows: makeRelative "C:\\Home" "C:Home\\Bob" == "C:Home\\Bob" Windows: makeRelative "/Home" "/home/bob" == "bob" Windows: makeRelative "/" "//" == "//" Posix: makeRelative "/Home" "/home/bob" == "/home/bob" Posix: makeRelative "/home/" "/home/bob/foo/bar" == "bob/foo/bar" Posix: makeRelative "/fred" "bob" == "bob" Posix: makeRelative "/file/test" "/file/test/fred" == "fred" Posix: makeRelative "/file/test" "/file/test/fred/" == "fred/" Posix: makeRelative "some/path" "some/path/a/b/c" == "a/b/c" Normalise a file)// outside of the drive can be made blank/ ->  ./ -> ""Does not remove "..", because of symlinks. Posix: normalise "/file/\\test////" == "/file/\\test/" Posix: normalise "/file/./test" == "/file/test" Posix: normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/" Posix: normalise "../bob/fred/" == "../bob/fred/" Posix: normalise "/a/../c" == "/a/../c" Posix: normalise "./bob/fred/" == "bob/fred/" Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\" Windows: normalise "c:\\" == "C:\\" Windows: normalise "C:.\\" == "C:" Windows: normalise "\\\\server\\test" == "\\\\server\\test" Windows: normalise "//server/test" == "\\\\server\\test" Windows: normalise "c:/file" == "C:\\file" Windows: normalise "/file" == "\\file" Windows: normalise "\\" == "\\" Windows: normalise "/./" == "\\" normalise "." == "." Posix: normalise "./" == "./" Posix: normalise "./." == "./" Posix: normalise "/./" == "/" Posix: normalise "/" == "/" Posix: normalise "bob/fred/." == "bob/fred/" Posix: normalise "//home" == "/home" Is a FilePath valid, i.e. could you create a file like it? This function checks for invalid names, and invalid characters, but does not check if length limits are exceeded, as these are typically filesystem dependent.  isValid "" == False isValid "\0" == False Posix: isValid "/random_ path:*" == True Posix: isValid x == not (null x) Windows: isValid "c:\\test" == True Windows: isValid "c:\\test:of_test" == False Windows: isValid "test*" == False Windows: isValid "c:\\test\\nul" == False Windows: isValid "c:\\test\\prn.txt" == False Windows: isValid "c:\\nul\\file" == False Windows: isValid "\\\\" == False Windows: isValid "\\\\\\foo" == False Windows: isValid "\\\\?\\D:file" == False Windows: isValid "foo\tbar" == False Windows: isValid "nul .txt" == False Windows: isValid " nul.txt" == True Take a FilePath and make it valid; does not change already valid FilePaths. isValid (makeValid x) isValid x ==> makeValid x == x makeValid "" == "_" makeValid "file\0name" == "file_name" Windows: makeValid "c:\\already\\/valid" == "c:\\already\\/valid" Windows: makeValid "c:\\test:of_test" == "c:\\test_of_test" Windows: makeValid "test*" == "test_" Windows: makeValid "c:\\test\\nul" == "c:\\test\\nul_" Windows: makeValid "c:\\test\\prn.txt" == "c:\\test\\prn_.txt" Windows: makeValid "c:\\test/prn.txt" == "c:\\test/prn_.txt" Windows: makeValid "c:\\nul\\file" == "c:\\nul_\\file" Windows: makeValid "\\\\\\foo" == "\\\\drive" Windows: makeValid "\\\\?\\D:file" == "\\\\?\\D:\\file" Windows: makeValid "nul .txt" == "nul _.txt" /Is a path relative, or is it fixed to the root? Windows: isRelative "path\\test" == True Windows: isRelative "c:\\test" == False Windows: isRelative "c:test" == True Windows: isRelative "c:\\" == False Windows: isRelative "c:/" == False Windows: isRelative "c:" == True Windows: isRelative "\\\\foo" == False Windows: isRelative "\\\\?\\foo" == False Windows: isRelative "\\\\?\\UNC\\foo" == False Windows: isRelative "/foo" == True Windows: isRelative "\\foo" == True Posix: isRelative "test/path" == True Posix: isRelative "/test" == False Posix: isRelative "/" == FalseAccording to [1]:/"A UNC name of any format [is never relative]."6"You cannot use the "\?" prefix with a relative path."  not .  "isAbsolute x == not (isRelative x) The stripSuffix function drops the given suffix from a list. It returns Nothing if the list did not end with the suffix given, or Just the list before the suffix, if it does.5       (c) Neil Mitchell 2005-2014BSD3ndmitchell@gmail.comstableportableSafep5 "(c) The University of Glasgow 2003/BSD-style (see the file libraries/base/LICENSE)libraries@haskell.org experimentalportable Trustworthy%&)*018:;<=> dTurn a value into a Template Haskell expression, suitable for use in a splice.0Generate a fresh name, which cannot be captured.For example, this: .f = $(do nm1 <- newName "x" let nm2 =  "x" return ( [ nm1] (LamE [VarP nm2] ( nm1))) )will produce the splice f = \x0 -> \x -> x0In particular, the occurrence VarE nm1 refers to the binding VarP nm1', and is not captured by the binding VarP nm2.Although names generated by newName cannot  be captured , they can capture other names. For example, this: g = $(do nm1 <- newName "x" let nm2 = mkName "x" return (LamE [VarP nm2] (LamE [VarP nm1] (VarE nm2))) )will produce the splice g = \x -> \x0 -> x0since the occurrence VarE nm2+ is captured by the innermost binding of x , namely VarP nm1.Generate a capturable name. Occurrences of such names will be resolved according to the Haskell scoping rules at the occurrence site. For example: =f = [| pi + $(varE (mkName "pi")) |] ... g = let pi = 3 in $fIn this case, g is desugared to g = Prelude.pi + 3 Note that mkName" may be used with qualified names: mkName "Prelude.pi" See also  for a useful combinator. The above example could be rewritten using  as f = [| pi + $(dyn "pi") |]Only used internally .Underlying untyped Template Haskell expression Extract the untyped representation from the typed representation template-haskellTurn a value into a Template Haskell typed expression, suitable for use in a typed splice. Unsafely convert an untyped code representation into a typed code representation.Only used internallyA  instance can have any of its values turned into a Template Haskell expression. This is needed when a value used within a Template Haskell quotation is bound outside the Oxford brackets ( [| ... |] or  [|| ... ||]*) but not at the top level. As an example: 0add1 :: Int -> Code Q Int add1 x = [|| x + 1 ||]2Template Haskell has no way of knowing what value x: will take on at splice-time, so it requires the type of x to be an instance of .A  instance must satisfy  $(lift x) D x and $$(liftTyped x) D x for all x, where $(...) and $$(...) are Template Haskell splices. It is additionally expected that  x D   (  x).6 instances can be derived automatically by use of the  -XDeriveLift GHC language extension: {-# LANGUAGE DeriveLift #-} module Foo where import Language.Haskell.TH.Syntax data Bar a = Bar1 a (Bar a) | Bar2 String deriving Lift!Representation-polymorphic since template-haskell-2.16.0.0.The  class implements the minimal interface which is necessary for desugaring quotations.The Monad m superclass is needed to stitch together the different AST fragments. is used when desugaring binding structures such as lambdas to generate fresh names.Therefore the type of an untyped quotation in GHC is `Quote m => m Exp`For many years the type of a quotation was fixed to be `Q Exp` but by more precisely specifying the minimal interface it enables the  to be extracted purely from the quotation without interacting with .Pattern in Haskell given in {}A data constructor.The constructors for  can roughly be divided up into two categories: those for constructors with "vanilla" syntax (, , and 0), and those for constructors with GADT syntax ( and ). The  constructor, which quantifies additional type variables and class contexts, can surround either variety of constructor. However, the type variables that it quantifies are different depending on what constructor syntax is used:If a : surrounds a constructor with vanilla syntax, then the  will only quantify  existential type variables. For example: % data Foo a = forall b. MkFoo a b In MkFoo,  will quantify b , but not a.If a 7 surrounds a constructor with GADT syntax, then the  will quantify all8 type variables used in the constructor. For example: > data Bar a b where MkBar :: (a ~ b) => c -> MkBar a b In MkBar,  will quantify a, b, and c.Multiplicity annotations for data types are currently not supported in Template Haskell (i.e. all fields represented by Template Haskell will be linear).7An abstract type representing names in the syntax tree.s can be constructed in several ways, which come with different name-capture guarantees (see &Language.Haskell.TH.Syntax#namecapture% for an explanation of name capture):the built-in syntax 'f and ''T4 can be used to construct names, The expression 'f gives a Name which refers to the value f currently in scope, and ''T gives a Name which refers to the type T7 currently in scope. These names can never be captured. and  are similar to 'f and ''T respectively, but the Names are looked up at the point where the current splice is being run. These names can never be captured. monadically generates a new name, which can never be captured. generates a capturable name.Names constructed using newName and mkName" may be used in bindings (such as  let x = ... or x -> ...), but names constructed using lookupValueName, lookupTypeName, 'f, ''T may not.Since the advent of ConstraintKinds, constraints are really just types. Equality constraints use the  constructor. Constraints may also be tuples of other constraints.One equation of a type family instance or closed type family. The arguments are the left-hand-side type and the right-hand-side result.3For instance, if you had the following type family: type family Foo (a :: k) :: k where forall k (a :: k). Foo @k a = a The  Foo @k a = a* equation would be represented as follows:  (  [ k,  a ( k)]) ( ( ( ''Foo) ( k)) ( a)) ( a) Injectivity annotationTo avoid duplication between kinds and types, they are defined to be the same. Naturally, you would never have a type be % and you would never have a kind be , but many of the other constructors are shared. Note that the kind Bool is denoted with , not '. Similarly, tuple kinds are made with , not .&Varieties of allowed instance overlap. A single deriving! clause at the end of a datatype. Code m a1typed splices inside of typed quotes, written as $$(...) where ...) is an arbitrary expression of type Quote m => Code m aTraditional expression quotes and splices let us construct ill-typed expressions:;fmap ppr $ runQ (unTypeCode [| True == $( [| "foo" |] ) |])#GHC.Types.True GHC.Classes.== "foo"#GHC.Types.True GHC.Classes.== "foo" error: @ Couldn't match expected type @Bool@ with actual type @[Char]@6 @ In the second argument of @(==)@, namely @"foo"@& In the expression: True == "foo"1 In an equation for @it@: it = True == "foo"3With typed expressions, the type error occurs when  constructing" the Template Haskell expression:fmap ppr $ runQ (unTypeCode [|| True == $$( [|| "foo" ||] ) ||]) error:. @ Couldn't match type @[Char]@ with @Bool@ Expected type: Code Q Bool" Actual type: Code Q [Char]5 @ In the Template Haskell quotation [|| "foo" ||]& In the expression: [|| "foo" ||]6 In the Template Haskell splice $$([|| "foo" ||]),May be overlapped by more specific instances#May overlap a more general instanceBoth  and Both  and , and pick an arbitrary one if multiple choices are available.Name may be everything; If there are two names in different namespaces, then consider bothName should be a type-level entity, such as a data type, type alias, type family, type class, or type variableName should be a term-level entity, such as a function, data constructor, or pattern synonymA location at which to attach Haddock documentation. Note that adding documentation to a < defined oustide of the current module will cause an error.At the current module's header.,At a declaration, not necessarily top level.?At a specific argument of a function, indexed by its position.At a class or family instance.&Annotation target for reifyAnnotationsRole annotations nominal representational phantom _ 2 "Hello"'C', @since 4.16.0.0Type family result signature no signature k = r, = (r :: k) a @aThe flag> type parameter is instantiated to one of the following types: (examples: , ) (examples: , , etc.)()9, a catch-all type for other forms of binders, including , , , and  a (a :: k) a {a} forall . =>  forall ->  T a b T @k t t :: k a T 'T T + T T + TSee  Language.Haskell.TH.Syntax#infix T :+: T T :+: TSee  Language.Haskell.TH.Syntax#infix (T)(,), (,,), etc.(#,#), (#,,#), etc.(#|#), (#||#), etc. -> %n ->1Generalised arrow type with multiplicity argument ~ []'(), '(,), '(,,), etc. '[] '(:) *  Constraint0, 1, 2, etc. _ ?x :: t"A pattern synonym's argument type. pattern P {x y z} = p pattern {x P y} = p pattern P { {x,y,z} } = p#A pattern synonym's directionality. pattern P x {<-} p pattern P x {=} p  pattern P x {<-} p where P x = eAs of template-haskell-2.11.0.0,  has been replaced by .As of template-haskell-2.11.0.0,  has been replaced by .As of template-haskell-2.11.0.0,  has been replaced by . C { {-# UNPACK #-} !}a C Int a C { v :: Int, w :: a } Int :+ a forall a. Eq a => C [a] C :: { v :: Int } -> T b IntUnlike  and ,  refers to the strictness annotations that the compiler chooses for a data constructor field, which may be different from what is written in source code.2Note that non-unpacked strict fields are assigned  when a bang would be inappropriate, such as the field of a newtype constructor and fields that have an unlifted type.See  for more information."Field inferred to not have a bang.Field inferred to have a bang.Field inferred to be unpacked. corresponds to strictness annotations found in the source code.4This may not agree with the annotations returned by . See  for more information. C a C {~}a C {!}a< corresponds to unpack annotations found in the source code.4This may not agree with the annotations returned by . See  for more information. C a C { {-# NOUNPACK #-} } a C { {-# UNPACK #-} } a +{ {-# COMPLETE C_1, ..., C_i [ :: T ] #-} } #{ {-# SCC fun "optional_name" #-} }Common elements of  and . By analogy with "head" for type classes and type class instances as defined in 0Type classes: an exploration of the design space, the TypeFamilyHead; is defined to be the elements of the declaration between  type family and where.8A pattern synonym's type. Note that a pattern synonym's fully specified type has a peculiar shape coming with two forall quantifiers and two constraint contexts. For example, consider the pattern synonym 'pattern P x1 x2 ... xn = *P's complete type is of the following form pattern P :: forall universals. required constraints => forall existentials. provided constraints => t1 -> t2 -> ... -> tn -> tconsisting of four parts: the (possibly empty lists of) universally quantified type variables and required constraints on them.the (possibly empty lists of) existentially quantified type variables and the provided constraints on them. the types t1, t2, .., tn of x1, x2, .., xn, respectively the type t of , mentioning only universals.Pattern synonym types interact with TH when (a) reifying a pattern synonym, (b) pretty printing, or (c) specifying a pattern synonym's type signature explicitly:/Reification always returns a pattern synonym's fully( specified type in abstract syntax.Pretty printing via  abbreviates a pattern synonym's type unambiguously in concrete syntax: The rule of thumb is to print initial empty universals and the required context as () =>, if existentials and a provided context follow. If only universals and their required context, but no existentials are specified, only the universals and their required context are printed. If both or none are specified, so both (or none) are printed.>When specifying a pattern synonym's type explicitly with  either one of the universals, the existentials, or their contexts may be left empty.See the GHC user's guide for more information on pattern synonyms and their types:  https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#pattern-synonyms.A "standard" derived instance -XDeriveAnyClass -XGeneralizedNewtypeDeriving  -XDerivingVia { deriving stock (Eq, Ord) }A way to specify a namespace to look in when GHC needs to find a name's source { f p1 p2 = b where decs } { p = b where decs } { data Cxt x => T x = A x | B (T x) deriving (Z,W) deriving stock Eq } { newtype Cxt x => T x = A (B x) deriving (Z,W Q) deriving stock Eq } !{ type data T x = A x | B (T x) } { type T x = (x,x) }  { class Eq a => Ord a where ds } { instance {-# OVERLAPS #-} Show w => Show [w] where ds } { length :: [a] -> Int } { type TypeRep :: k -> Type } -{ foreign import ... } { foreign export ... } { infix 3 data foo } { default (Integer, Double) }pragmas+data families (may also appear in [Dec] of  and ) { data instance Cxt x => T [x] = A x | B (T x) deriving (Z,W) deriving stock Eq } { newtype instance Cxt x => T [x] = A (B x) deriving (Z,W) deriving stock Eq } { type instance ... }0open type families (may also appear in [Dec] of  and ) 3{ type family F a b = (r :: *) | r -> a where ... } ({ type role T nominal representational } 0{ deriving stock instance Ord a => Ord (Foo a) } &{ default size :: Data a => a -> Int }Pattern Synonyms#A pattern synonym's type signature.  { ?x = expr }Implicit parameter binding declaration. Can only be used in let and where clauses which consist entirely of implicit bindings. p <- e { let { x=e1; y=e2 } } ex <- e1 | s2, s3 | s4 (in ) rec { s1; s2 } f x { | odd x } = x &f x { | Just y <- x, Just z <- y } = z +f p { | e1 = e2 | e3 = e4 } where ds f p { = e } where ds { x } "data T1 = C1 t1 t2; p = {C1} e1 e2  { 5 or 'c'} { f x }  { f @Int } %{x + y} or {(x+)} or {(+ x)} or {(+)} {x + y}See  Language.Haskell.TH.Syntax#infix { (e) }See  Language.Haskell.TH.Syntax#infix { \ p1 p2 -> e } { \case m1; m2 } { \cases m1; m2 }  { (e1,e2) }The  + is necessary for handling tuple sections. (1,) translates to 'TupE [Just (LitE (IntegerL 1)),Nothing] { (# e1,e2 #) }The  + is necessary for handling tuple sections.  (# 'c', #) translates to -UnboxedTupE [Just (LitE (CharL 'c')),Nothing]  { (#|e|#) } { if e1 then e2 else e3 } { if | g1 -> e1 | g2 -> e2 } { let { x=e1; y=e2 } in e3 } { case e of m1; m2 }{ do { p <- e1; e2 } }1 or a qualified do if the module name is present!{ mdo { x <- e1 y; y <- e2 x; } }2 or a qualified mdo if the module name is present  { [ (x,y) | x <- xs, y <- ys ] }3The result expression of the comprehension is the last of the s, and should be a .E.g. translation: [ f x | x <- xs ] CompE [BindS (VarP x) (VarE xs), NoBindS (AppE (VarE f) (VarE x))] { [ 1 ,2 .. 10 ] }  { [1,2,3] }  { e :: t } { T { x = y, z = w } } { (f x) { z = w } }  { static e } { _x }This is used for holes or unresolved identifiers in AST quotes. Note that it could either have a variable name or constructor name.{ #x } ( Overloaded label ){ ?x } ( Implicit parameter ) { exp.field } ( Overloaded Record Dot )(.x) or (.x.y) (Record projections)  [|| e ||] $$e  { type t } f { p1 p2 = body where decs } $case e of { pat -> body where decs }  { 5 or 'c' } { x }  { (p1,p2) } { (# p1,p2 #) }  { (#|p|#) } 'data T1 = C1 t1 t2; {C1 @ty1 p1 p2} = e foo ({x :+ y}) = e foo ({x :+ y}) = eSee  Language.Haskell.TH.Syntax#infix {(p)}See  Language.Haskell.TH.Syntax#infix { ~p } { !p }  { x @ p } { _ } f (Pt { pointx = x }) = g x  { [1,2,3] }  { p :: t }  { e -> p }  { type p }{ p }@#Raw bytes embedded into the binary.Avoid using Bytes constructor directly as it is likely to change in the future. Use helpers such as mkBytes$ in Language.Haskell.TH.Lib instead.Number of bytesOffset from the pointerPointer to the dataUsed for overloaded and non-overloaded literals. We don't have a good way to represent non-overloaded literals at the moment. Maybe that doesn't matter?!A primitive C-style string, type  Some raw bytes, type  : describes a single instance of a class or type function. It is just a ,, but guaranteed to be one of the following: (with empty []) or  (with empty derived [])In #, is the type constructor unlifted?In , arity of the type constructorIn , , and , the total number of s. For example, (#|#) has a  of 2.In  and =, the number associated with a particular data constructor. s are one-indexed and should never exceed the value of its corresponding . For example:(#_|#) has  1 (out of a total  of 2)(#|_#) has  2 (out of a total  of 2)In  and ", name of the parent class or typeObtained from  in the  Monad.'Contains the import list of the module.Obtained from  in the  Monad.-A class, with a list of its visible instancesA class methodA "plain" type constructor. "Fancier" type constructors are returned using  or  as appropriate. At present, this reified declaration will never have derived instances attached to it (if you wish to check for an instance, see ).A type or data family, with a list of its visible instances. A closed type family is returned with 0 instances.A "primitive" type constructor, which can't be expressed with a  . Examples: (->), Int#.A data constructorA pattern synonym7A "value" variable (as opposed to a type variable, see ).The  Maybe Dec field contains Just the declaration which defined the variable - including the RHS of the declaration - or else Nothing, in the case where the RHS is unavailable to the compiler. At present, this value is always Nothing: returning the RHS has not yet been implemented because of lack of interest.A type variable.The Type field contains the type which underlies the variable. At present, this is always  theName5, but future changes may permit refinement of this.Uniq5 is used by GHC to distinguish names from each other. VariablesData constructorsType constructors and classes; Haskell has them in the same name space for now.,The textual name of the parent of the field.For a field of a datatype, this is the name of the first constructor of the datatype (regardless of whether this constructor has this field).For a field of a pattern synonym, this is the name of the pattern synonym.&An unqualified name; dynamically bound#A qualified name; dynamically boundA unique local name&Local name bound outside of the TH ASTGlobal name bound outside of the TH AST: An original name (occurrences only, not binders) Need the namespace too to be sure which thing we are namingObtained from  and .Underlying monadic valueTyped wrapper around an .This is the typed representation of terms produced by typed quotes.!Representation-polymorphic since template-haskell-2.16.0.0.Discard the type annotation and produce a plain Template Haskell expression!Representation-polymorphic since template-haskell-2.16.0.0.4Annotate the Template Haskell expression with a typeThis is unsafe because GHC cannot check for you that the expression really does have the type you claim it has.!Representation-polymorphic since template-haskell-2.16.0.0.4Lift a monadic action producing code into the typed  representationModify the ambient monad used during code generation. For example, you can use  to handle a state effect:  handleState :: Code (StateT Int Q) a -> Code Q a handleState = hoistCode (flip runState 0) Variant of (>>=) which allows effectful computations to be injected into code generation.Variant of (>>) which allows effectful computations to be injected into code generation.7A useful combinator for embedding monadic actions into   myCode :: ... => Code m a myCode = joinCode $ do x <- someSideEffect return (makeCodeWith x) >Report an error (True) or warning (False), but carry on; use   to stop.Report an error to the user, but allow the current splice's computation to carry on. To abort the computation, use  .+Report a warning to the user, and carry on.Recover from errors raised by  or  .Look up the given name in the (type namespace of the) current splice's scope. See %Language.Haskell.TH.Syntax#namelookup for more details.Look up the given name in the (value namespace of the) current splice's scope. See %Language.Haskell.TH.Syntax#namelookup for more details. looks up information about the +. It will fail with a compile error if the  is not visible. A  is visible if it is imported or defined in a prior top-level declaration group. See the documentation for  for more details. Bool, and reifyType ''Bool returns Type. This works even if there's no explicit signature and the type or kind is inferred.Template Haskell is capable of reifying information about types and terms defined in previous declaration groups. Top-level declaration splices break up declaration groups.For an example, consider this code block. We define a datatype X and then try to call  on the datatype. module Check where data X = X deriving Eq $(do info <- reify ''X runIO $ print info ) (This code fails to compile, noting that X1 is not available for reification at the site of . We can fix this by creating a new declaration group using an empty top-level splice: data X = X deriving Eq $(pure []) $(do info <- reify ''X runIO $ print info )  We provide  as a means of documenting this behavior and providing a name for the pattern.2Since top level splices infer the presence of the $( ... ) brackets, we can also write: data X = X deriving Eq newDeclarationGroup $(do info <- reify ''X runIO $ print info ) reifyInstances nm tys returns a list of all visible instances (see below for "visible") of nm tys. That is, if nm is the name of a type class, then all instances of this class at the types tys! are returned. Alternatively, if nm is the name of a data family or type family, all instances of this family at the types tys are returned.Note that this is a "shallow" test; the declarations returned merely have instance heads which unify with nm tys(, they need not actually be satisfiable.reifyInstances ''Eq [  2 ``  ''A ``  ''B ] contains the "instance (Eq a, Eq b) => Eq (a, b) regardless of whether A and B themselves implement  reifyInstances ''Show [  ( "a") ]* produces every available instance of  There is one edge case: reifyInstances ''Typeable tys9 currently always produces an empty list (no matter what tys are given).In principle, the *visible* instances are * all instances defined in a prior top-level declaration group (see docs on newDeclarationGroup), or * all instances defined in any module transitively imported by the module being compiledHowever, actually searching all modules transitively below the one being compiled is unreasonably expensive, so reifyInstances will report only the instance for modules that GHC has had some cause to visit during this compilation. This is a shortcoming: reifyInstances might fail to report instances for a type that is otherwise unusued, or instances defined in a different component. You can work around this shortcoming by explicitly importing the modules whose instances you want to be visible. GHC issue  =https://gitlab.haskell.org/ghc/ghc/-/issues/20529#note_388980#20529! has some discussion around this. reifyRoles nm returns the list of roles associated with the parameters (both visible and invisible) of the tycon nm . Fails if nm cannot be found or is not a tycon. The returned list should never contain .An invisible parameter to a tycon is often a kind parameter. For example, if we have 9type Proxy :: forall k. k -> Type data Proxy a = MkProxy and reifyRoles Proxy, we will get [, ]. The  is the role of the invisible k/ parameter. Kind parameters are always nominal.reifyAnnotations target2 returns the list of annotations associated with target. Only the annotations that are appropriately typed is returned. So if you have Int and String annotations for the same target, you have to call this function twice.reifyModule mod# looks up information about module mod. To look up the current module, call this function with the return value of .reifyConStrictness nm looks up the strictness information for the fields of the constructor with the name nm-. Note that the strictness information that  returns may not correspond to what is written in the source code. For example, in the following data declaration: data Pair a = Pair a a  would return [, DecidedLazy]0 under most circumstances, but it would return [, DecidedStrict] if the  -XStrictData language extension was enabled.%Is the list of instances returned by  nonempty?If you're confused by an instance not being visible despite being defined in the same module and above the splice in question, see the docs for  for a possible explanation.2The location at which this computation is spliced.The 1 function lets you run an I/O computation in the  monad. Take care: you are guaranteed the ordering of calls to  within a single ? computation, but not about the order in which splices are run.Note: for various murky reasons, stdout and stderr handles are not necessarily flushed when the compiler finishes running, so you should flush them yourself.Get the package root for the current package which is being compiled. This can be set explicitly with the -package-root flag but is normally just the current working directory.The motivation for this flag is to provide a principled means to remove the assumption from splices that they will be executed in the directory where the cabal file resides. Projects such as haskell-language-server can't and don't change directory when compiling files but instead set the -package-root flag appropriately.The input is a filepath, which if relative is offset by the package root.Record external files that runIO is using (dependent upon). The compiler can then recognize that it should re-compile the Haskell file when an external file changes.Expects an absolute file path.Notes:ghc -M does not know about these dependencies - it does not execute TH.The dependency is based on file content, not a modification timeObtain a temporary file path with the given suffix. The compiler will delete this file after compilation.Add additional top-level declarations. The added declarations will be type checked along with the current declaration group.Emit a foreign file which will be compiled and linked to the object for the current module. Currently only languages that can be compiled with the C compiler are supported, and the flags passed as part of -optc will be also applied to the C compiler invocation that will compile them.0Note that for non-C languages (for example C++) extern C directives must be used to get symbols that we can access from Haskell.To get better errors, it is recommended to use #line pragmas when emitting C files, e.g. {-# LANGUAGE CPP #-} ... addForeignSource LangC $ unlines [ "#line " ++ show (844 + 1) ++ " " ++ show "libraries/template-haskell/Language/Haskell/TH/Syntax.hs" , ... ]Same as , but expects to receive a path pointing to the foreign file instead of a  ; of its contents. Consider using this in conjunction with .This is a good alternative to 9 when you are trying to directly link in an object file.Add a finalizer that will run in the Q monad after the current module has been type checked. This only makes sense when run within a top-level splice.The finalizer is given the local type environment at the splice point. Thus  is able to find the local definitions when executed inside the finalizer./Adds a core plugin to the compilation pipeline.addCorePlugin m' has almost the same effect as passing  -fplugin=m to ghc in the command line. The major difference is that the plugin module m must not belong to the current package. When TH executes, it is too late to tell the compiler that we needed to compile first a plugin module in the current package.Get state from the  monad. Note that the state is local to the Haskell module in which the Template Haskell expression is executed.Replace the state in the  monad. Note that the state is local to the Haskell module in which the Template Haskell expression is executed.Determine whether the given language extension is enabled in the  monad.%List all enabled language extensions.Add Haddock documentation to the specified location. This will overwrite any documentation at the location if it already exists. This will reify the specified name, so it must be in scope when you call it. If you want to add documentation to something that you are currently splicing, you can use  e.g. do let nm = mkName "x" addModFinalizer $ putDoc (DeclDoc nm) "Hello" [d| $(varP nm) = 42 |]The helper functions  withDecDoc and  withDecsDoc$ will do this for you, as will the funD_doc and other _doc0 combinators. You most likely want to have the -haddock flag turned on when using this. Adding documentation to anything outside of the current module will cause an error.Retrieves the Haddock documentation at the specified location, if one exists. It can be used to read documentation on things defined outside of the current module, provided that those modules were compiled with the -haddock flag. is an internal utility function for constructing generic conversion functions from types with   instances to various quasi-quoting representations. See the source of  and  for two example usages: mkCon, mkLit and appQ are overloadable to account for different syntax for expressions and patterns; antiQ allows you to override type-specific cases, a common usage is just  const Nothing#, which results in no overloading. converts a value to a  representation of the same value, in the SYB style. It is generalized to take a function override type-specific cases; see # for a more commonly used variant. is a variant of  in the - type class which works for any type with a   instance. converts a value to a  representation of the same value, in the SYB style. It takes a function to handle type-specific cases, alternatively, pass  const Nothing to get default behavior.#The name without its module prefix.ExamplesnameBase ''Data.Either.Either"Either"nameBase (mkName "foo")"foo"nameBase (mkName "Module.foo")"foo"&Module prefix of a name, if it exists.ExamplesnameModule ''Data.Either.EitherJust "Data.Either"nameModule (mkName "foo")Nothing nameModule (mkName "Module.foo") Just "Module"A name's package, if it exists.Examples namePackage ''Data.Either.Either Just "base"namePackage (mkName "foo")Nothing!namePackage (mkName "Module.foo")NothingReturns whether a name represents an occurrence of a top-level variable (), data constructor (%), type constructor, or type class (#). If we can't be sure, it returns  .ExamplesnameSpace 'Prelude.id Just VarNamenameSpace (mkName "id")2Nothing -- only works for top-level variable namesnameSpace 'Data.Maybe.Just Just DataNamenameSpace ''Data.Maybe.MaybeJust TcClsNamenameSpace ''Data.Ord.OrdJust TcClsNameOnly used internally4Used for 'x etc, but not available to the programmerTuple data constructorTuple type constructorUnboxed tuple data constructorUnboxed tuple type constructorUnboxed sum data constructorUnboxed sum type constructor(Highest allowed operator precedence for  constructor (answer: 9)Default fixity: infixl 9template-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskell Produces an   literal from the NUL-terminated C-string starting at the given memory address.template-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskelltemplate-haskellIf the function passed to  ; inspects its argument, the resulting action will throw a  .template-haskelltemplate-haskell packagemodule)parent (first constructor of parent type) field nameThe list of constructors, corresponding to the GADT constructor syntax C1, C2 :: a -> T b.&Invariant: the list must be non-empty.The constructor argumentsSee Note [GADT return type]The list of constructors, corresponding to the GADT record constructor syntax C1, C2 :: { fld :: a } -> T b.&Invariant: the list must be non-empty.The constructor argumentsSee Note [GADT return type]  (Eq a, Ord b) { {-# INLINE [1] foo #-} } { data family T a b c :: * } -{ type family T a b c = (r :: *) | r -> a b }{ pattern P v1 v2 .. vn <- p }! unidirectional or { pattern P v1 v2 .. vn = p }! implicit bidirectional or ?{ pattern P v1 v2 .. vn <- p where P v1 v2 .. vn = e } explicit bidirectionalalso, besides prefix pattern synonyms, both infix and record pattern synonyms are supported. See  for detailsLine and character position Fresh namesReport an error (True) or warning (False) ...but carry on; use   to stopthe error handleraction which may failRecover from the monadic  handler to invoke on failurecomputation to run         *Quasi-quoting support for Template HaskellSafe5Quasi-quoter for expressions, invoked by quotes like lhs = $[q|...]2Quasi-quoter for patterns, invoked by quotes like f $[q|...] = rhs:Quasi-quoter for declarations, invoked by top-level quotes/Quasi-quoter for types, invoked by quotes like  f :: $[q|...] The   type, a value q) of this type can be used in the syntax [q| ... string to parse ...|] . In fact, for convenience, a   actually defines multiple quasiquoters to be used in different splice contexts; if you are only interested in defining a quasiquoter to be used for expressions, you would define a   with only 6, and leave the other fields stubbed out with errors.   takes a   and lifts it into one that read the data out of a file. For example, suppose asmq is an assembly-language quoter, so that you can write [asmq| ld r1, r2 |] as an expression. Then if you define asmq_f = quoteFile asmq<, then the quote [asmq_f|foo.s|] will take input from file "foo.s" instead of the inline text    Safe" Returns   if the document is empty An empty document A ';' character A ',' character A : character  A "::" string A space character A '=' character  A "->" string A '(' character A ')' character A '[' character A ']' character A '{' character A '}' character Wrap document in (...) Wrap document in [...] Wrap document in {...} Wrap document in '...' Wrap document in "..." Beside List version of  Beside, separated by space List version of  5Above; if there is no overlap it "dovetails" the two Above, without dovetailing. List version of  Either hcat or vcat Either hsep or vcat "Paragraph fill" version of cat "Paragraph fill" version of sep Nested  "hang d1 n d2 = sep [d1, nest n d2]  punctuate p [d1, ... dn] = [d1 <> p, d2 <> p, ... dn-1 <> p, dn]/ /       Safe! .Pretty prints a pattern synonym type signature Pretty prints a pattern synonym's type; follows the usual conventions to print a pattern synonym type compactly, yet unambiguously. See the note on  and the section on pattern synonyms in the GHC user's guide for more information. declaration on the toplevel? declaration on the toplevel? declaration on the toplevel? declaration on the toplevel?  Trustworthy0-- Use with A. Use with ^9 Lambda-case (case):Lambda-cases (cases)L staticE x = [| static x |]yPattern synonym declarationzPattern synonym type signature|Implicit parameter binding declaration. Can only be used in let and where clauses which consist entirely of implicit bindings. !Representation-polymorphic since template-haskell-2.17.0.0. +Dynamically binding a variable (unhygienic) Single-arg lambda pure the Module at the place of splicing. Can be used as an input for . Attaches Haddock documentation to the declaration provided. Unlike , the names do not need to be in scope when calling this function so it can be used for quoted declarations and anything else currently being spliced. Not all declarations can have documentation attached to them. For those that can't,  3 will return it unchanged without any side effects.  Variant of   that applies the same documentation to multiple declarations. Useful for documenting quoted declarations.  Variant of ^% that attaches Haddock documentation.  Variant of `% that attaches Haddock documentation.  Variant of a% that attaches Haddock documentation.  Variant of % that attaches Haddock documentation.  Variant of o% that attaches Haddock documentation.  Variant of p% that attaches Haddock documentation.  Variant of y% that attaches Haddock documentation. 7Document a data/newtype constructor with its arguments. #Documentation to attach to function$Documentation to attach to arguments List of constructors, documentation for the constructor, and documentation for the arguments/Documentation to attach to the data declaration The constructor, documentation for the constructor, and documentation for the arguments2Documentation to attach to the newtype declaration List of constructors, documentation for the constructor, and documentation for the arguments/Documentation to attach to the data declaration List of constructors, documentation for the constructor, and documentation for the arguments3Documentation to attach to the instance declaration The constructor, documentation for the constructor, and documentation for the arguments3Documentation to attach to the instance declaration .Documentation to attach to the pattern synonym0Documentation to attach to the pattern arguments2 3 $#Y Ac .rC0 >` mo ~xB  T,fD E G F ^ QU|O54 s u! t d+ }N 9:8@ZH '1-P?a p [V W n\ Xy zl{g khijR  J&]Kv67eI( wL  "; bq S*  M=< _/  )%               ! "#$%&'(*+),YZ[\] VU W X-. /0123 45678 9:;<=>?@ABPC HIJK TLMNOQR DEFGS_^b`ac de}f stu~ghijkl {opqmnrv wxyz|      Safe1 template-haskellCreate a Bytes datatype representing raw bytes to be embedded into the program/library binary. Pointer to the dataOffset from the pointerNumber of bytes 2 3 $#Y A .C0 > ~x T,fD E G F ^ QU|O54 !  d+ }N 9:8@ZH '1-? [V W \ Xy zl{g hijR  J&]Kv67eI( L  " q S*  M= _/  )%             !"#$%&'()*+,VU W X-. /MNO01L23 45678 9: =>?@A HIJK TQR SDEFG CYZ[\]        _^  de} xv q  ~fghij l {yz|  Safe-Inferred5 Module over monad operator for   Safe6% 2 3 $#Y A .C0 > ~x T,fD E G F ^ QU|O54 !  d+ }N 9:8@ZH '1-? [V W \ Xy zl{g hijR  J&]Kv67eI( L  " q S*  M= _/  )%             (c) Neil Mitchell 2005-2014BSD3ndmitchell@gmail.comstableportable Safe-Inferred9 *Is the operating system Unix or Linux like $Is the operating system Windows like The character that separates directories. In the case where more than one character is possible,   is the 'ideal' one. Windows: pathSeparator == '\\' Posix: pathSeparator == '/' isPathSeparator pathSeparator $The list of all possible separators. Windows: pathSeparators == ['\\', '/'] Posix: pathSeparators == ['/'] pathSeparator `elem` pathSeparators Rather than using (==  )5, use this. Test if something is a path separator. .isPathSeparator a == (a `elem` pathSeparators) The character that is used to separate the entries in the $PATH environment variable. Windows: searchPathSeparator == ';' Posix: searchPathSeparator == ':' "Is the character a file separator? 5isSearchPathSeparator a == (a == searchPathSeparator) File extension character extSeparator == '.' (Is the character an extension character? 'isExtSeparator a == (a == extSeparator) Take a string, split it on the   character. Blank items are ignored on Windows, and converted to .> on Posix. On Windows path elements are stripped of quotes."Follows the recommendations in http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html Posix: splitSearchPath "File1:File2:File3" == ["File1","File2","File3"] Posix: splitSearchPath "File1::File2:File3" == ["File1",".","File2","File3"] Windows: splitSearchPath "File1;File2;File3" == ["File1","File2","File3"] Windows: splitSearchPath "File1;;File2;File3" == ["File1","File2","File3"] Windows: splitSearchPath "File1;\"File2\";File3" == ["File1","File2","File3"] Get a list of  s in the $PATH variable. Split on the extension.   is the inverse. splitExtension "/directory/path.ext" == ("/directory/path",".ext") uncurry (++) (splitExtension x) == x Valid x => uncurry addExtension (splitExtension x) == x splitExtension "file.txt" == ("file",".txt") splitExtension "file" == ("file","") splitExtension "file/file.txt" == ("file/file",".txt") splitExtension "file.txt/boris" == ("file.txt/boris","") splitExtension "file.txt/boris.ext" == ("file.txt/boris",".ext") splitExtension "file/path.txt.bob.fred" == ("file/path.txt.bob",".fred") splitExtension "file/path.txt/" == ("file/path.txt/","") %Get the extension of a file, returns "" for no extension, .ext otherwise. takeExtension "/directory/path.ext" == ".ext" takeExtension x == snd (splitExtension x) Valid x => takeExtension (addExtension x "ext") == ".ext" Valid x => takeExtension (replaceExtension x "ext") == ".ext"  "ext" == "/directory/path.ext" "/directory/path.txt" -<.> ".ext" == "/directory/path.ext" "foo.o" -<.> "c" == "foo.c" Set the extension of a file, overwriting one if already present, equivalent to  . replaceExtension "/directory/path.txt" "ext" == "/directory/path.ext" replaceExtension "/directory/path.txt" ".ext" == "/directory/path.ext" replaceExtension "file.txt" ".bob" == "file.bob" replaceExtension "file.txt" "bob" == "file.bob" replaceExtension "file" ".bob" == "file.bob" replaceExtension "file.txt" "" == "file" replaceExtension "file.fred.bob" "txt" == "file.fred.txt" replaceExtension x y == addExtension (dropExtension x) y Add an extension, even if there is already one there, equivalent to  . "/directory/path" <.> "ext" == "/directory/path.ext" "/directory/path" <.> ".ext" == "/directory/path.ext" 0Remove last extension, and the "." preceding it. dropExtension "/directory/path.ext" == "/directory/path" dropExtension x == fst (splitExtension x) Add an extension, even if there is already one there, equivalent to  . addExtension "/directory/path" "ext" == "/directory/path.ext" addExtension "file.txt" "bib" == "file.txt.bib" addExtension "file." ".bib" == "file..bib" addExtension "file" ".bib" == "file.bib" addExtension "/" "x" == "/.x" addExtension x "" == x Valid x => takeFileName (addExtension (addTrailingPathSeparator x) "ext") == ".ext" Windows: addExtension "\\\\share" ".txt" == "\\\\share\\.txt" *Does the given filename have an extension? hasExtension "/directory/path.ext" == True hasExtension "/directory/path" == False null (takeExtension x) == not (hasExtension x) 5Does the given filename have the specified extension? "png" `isExtensionOf` "/directory/file.png" == True ".png" `isExtensionOf` "/directory/file.png" == True ".tar.gz" `isExtensionOf` "bar/foo.tar.gz" == True "ar.gz" `isExtensionOf` "bar/foo.tar.gz" == False "png" `isExtensionOf` "/directory/file.png.jpg" == False "csv/table.csv" `isExtensionOf` "/data/csv/table.csv" == False 2Drop the given extension from a FilePath, and the "." preceding it. Returns  : if the FilePath does not have the given extension, or  . and the part before the extension if it does.+This function can be more predictable than  5, especially if the filename might itself contain . characters. stripExtension "hs.o" "foo.x.hs.o" == Just "foo.x" stripExtension "hi.o" "foo.x.hs.o" == Nothing dropExtension x == fromJust (stripExtension (takeExtension x) x) dropExtensions x == fromJust (stripExtension (takeExtensions x) x) stripExtension ".c.d" "a.b.c.d" == Just "a.b" stripExtension ".c.d" "a.b..c.d" == Just "a.b." stripExtension "baz" "foo.bar" == Nothing stripExtension "bar" "foobar" == Nothing stripExtension "" x == Just x Split on all extensions. splitExtensions "/directory/path.ext" == ("/directory/path",".ext") splitExtensions "file.tar.gz" == ("file",".tar.gz") uncurry (++) (splitExtensions x) == x Valid x => uncurry addExtension (splitExtensions x) == x splitExtensions "file.tar.gz" == ("file",".tar.gz") Drop all extensions. dropExtensions "/directory/path.ext" == "/directory/path" dropExtensions "file.tar.gz" == "file" not $ hasExtension $ dropExtensions x not $ any isExtSeparator $ takeFileName $ dropExtensions x Get all extensions. takeExtensions "/directory/path.ext" == ".ext" takeExtensions "file.tar.gz" == ".tar.gz" Replace all extensions of a file with a new extension. Note that   and   both work for adding multiple extensions, so only required when you need to drop all extensions first. replaceExtensions "file.fred.bob" "txt" == "file.txt" replaceExtensions "file.fred.bob" "tar.gz" == "file.tar.gz" Is the given character a valid drive letter? only a-z and A-Z are letters, not isAlpha which is more unicodey Split a path into a drive and a path. On Posix, / is a Drive. uncurry (++) (splitDrive x) == x Windows: splitDrive "file" == ("","file") Windows: splitDrive "c:/file" == ("c:/","file") Windows: splitDrive "c:\\file" == ("c:\\","file") Windows: splitDrive "\\\\shared\\test" == ("\\\\shared\\","test") Windows: splitDrive "\\\\shared" == ("\\\\shared","") Windows: splitDrive "\\\\?\\UNC\\shared\\file" == ("\\\\?\\UNC\\shared\\","file") Windows: splitDrive "\\\\?\\UNCshared\\file" == ("\\\\?\\","UNCshared\\file") Windows: splitDrive "\\\\?\\d:\\file" == ("\\\\?\\d:\\","file") Windows: splitDrive "/d" == ("","/d") Posix: splitDrive "/test" == ("/","test") Posix: splitDrive "//test" == ("//","test") Posix: splitDrive "test/file" == ("","test/file") Posix: splitDrive "file" == ("","file") &Join a drive and the rest of the path. Valid x => uncurry joinDrive (splitDrive x) == x Windows: joinDrive "C:" "foo" == "C:foo" Windows: joinDrive "C:\\" "bar" == "C:\\bar" Windows: joinDrive "\\\\share" "foo" == "\\\\share\\foo" Windows: joinDrive "/:" "foo" == "/:\\foo" Get the drive from a filepath. !takeDrive x == fst (splitDrive x) Delete the drive, if it exists. !dropDrive x == snd (splitDrive x) Does a path have a drive. not (hasDrive x) == null (takeDrive x) Posix: hasDrive "/foo" == True Windows: hasDrive "C:\\foo" == True Windows: hasDrive "C:foo" == True hasDrive "foo" == False hasDrive "" == False Is an element a drive Posix: isDrive "/" == True Posix: isDrive "/foo" == False Windows: isDrive "C:\\" == True Windows: isDrive "C:\\foo" == False isDrive "" == False *Split a filename into directory and file.   is the inverse. The first component will often end with a trailing slash. splitFileName "/directory/file.ext" == ("/directory/","file.ext") Valid x => uncurry () (splitFileName x) == x || fst (splitFileName x) == "./" Valid x => isValid (fst (splitFileName x)) splitFileName "file/bob.txt" == ("file/", "bob.txt") splitFileName "file/" == ("file/", "") splitFileName "bob" == ("./", "bob") Posix: splitFileName "/" == ("/","") Windows: splitFileName "c:" == ("c:","") Set the filename. replaceFileName "/directory/other.txt" "file.ext" == "/directory/file.ext" Valid x => replaceFileName x (takeFileName x) == x Drop the filename. Unlike  , this function will leave a trailing path separator on the directory. dropFileName "/directory/file.ext" == "/directory/" dropFileName x == fst (splitFileName x) Get the file name. takeFileName "/directory/file.ext" == "file.ext" takeFileName "test/" == "" takeFileName x `isSuffixOf` x takeFileName x == snd (splitFileName x) Valid x => takeFileName (replaceFileName x "fred") == "fred" Valid x => takeFileName (x "fred") == "fred" Valid x => isRelative (takeFileName x) 0Get the base name, without an extension or path. takeBaseName "/directory/file.ext" == "file" takeBaseName "file/test.txt" == "test" takeBaseName "dave.ext" == "dave" takeBaseName "" == "" takeBaseName "test" == "test" takeBaseName (addTrailingPathSeparator x) == "" takeBaseName "file/file.tar.gz" == "file.tar" Set the base name. replaceBaseName "/directory/other.ext" "file" == "/directory/file.ext" replaceBaseName "file/test.txt" "bob" == "file/bob.txt" replaceBaseName "fred" "bill" == "bill" replaceBaseName "/dave/fred/bob.gz.tar" "new" == "/dave/fred/new.tar" Valid x => replaceBaseName x (takeBaseName x) == x Is an item either a directory or the last character a path separator? hasTrailingPathSeparator "test" == False hasTrailingPathSeparator "test/" == True Add a trailing file path separator if one is not already present. hasTrailingPathSeparator (addTrailingPathSeparator x) hasTrailingPathSeparator x ==> addTrailingPathSeparator x == x Posix: addTrailingPathSeparator "test/rest" == "test/rest/" #Remove any trailing path separators dropTrailingPathSeparator "file/test/" == "file/test" dropTrailingPathSeparator "/" == "/" Windows: dropTrailingPathSeparator "\\" == "\\" Posix: not (hasTrailingPathSeparator (dropTrailingPathSeparator x)) || isDrive x *Get the directory name, move up one level.  takeDirectory "/directory/other.ext" == "/directory" takeDirectory x `isPrefixOf` x || takeDirectory x == "." takeDirectory "foo" == "." takeDirectory "/" == "/" takeDirectory "/foo" == "/" takeDirectory "/foo/bar/baz" == "/foo/bar" takeDirectory "/foo/bar/baz/" == "/foo/bar/baz" takeDirectory "foo/bar/baz" == "foo/bar" Windows: takeDirectory "foo\\bar" == "foo" Windows: takeDirectory "foo\\bar\\\\" == "foo\\bar" Windows: takeDirectory "C:\\" == "C:\\" 1Set the directory, keeping the filename the same. replaceDirectory "root/file.ext" "/directory/" == "/directory/file.ext" Valid x => replaceDirectory x (takeDirectory x) `equalFilePath` x  An alias for  . 0Combine two paths, assuming rhs is NOT absolute. Combine two paths with a path separator. If the second path starts with a path separator or a drive letter, then it returns the second. The intention is that readFile (dir   file)! will access the same file as &setCurrentDirectory dir; readFile file. Posix: "/directory" "file.ext" == "/directory/file.ext" Windows: "/directory" "file.ext" == "/directory\\file.ext" "directory" "/file.ext" == "/file.ext" Valid x => (takeDirectory x takeFileName x) `equalFilePath` x Combined: Posix: "/" "test" == "/test" Posix: "home" "bob" == "home/bob" Posix: "x:" "foo" == "x:/foo" Windows: "C:\\foo" "bar" == "C:\\foo\\bar" Windows: "home" "bob" == "home\\bob" Not combined: Posix: "home" "/bob" == "/bob" Windows: "home" "C:\\bob" == "C:\\bob"Not combined (tricky):On Windows, if a filepath starts with a single slash, it is relative to the root of the current drive. In [1], this is (confusingly) referred to as an absolute path. The current behavior of  ! is to never combine these forms. Windows: "home" "/bob" == "/bob" Windows: "home" "\\bob" == "\\bob" Windows: "C:\\home" "\\bob" == "\\bob"On Windows, from [1]: "If a file name begins with only a disk designator but not the backslash after the colon, it is interpreted as a relative path to the current directory on the drive with the specified letter." The current behavior of  ! is to never combine these forms. Windows: "D:\\foo" "C:bar" == "C:bar" Windows: "C:\\foo" "C:bar" == "C:bar" (Split a path by the directory separator. splitPath "/directory/file.ext" == ["/","directory/","file.ext"] concat (splitPath x) == x splitPath "test//item/" == ["test//","item/"] splitPath "test/item/file" == ["test/","item/","file"] splitPath "" == [] Windows: splitPath "c:\\test\\path" == ["c:\\","test\\","path"] Posix: splitPath "/file/test" == ["/","file/","test"] Just as  5, but don't add the trailing slashes to each element.  splitDirectories "/directory/file.ext" == ["/","directory","file.ext"] splitDirectories "test/file" == ["test","file"] splitDirectories "/test/file" == ["/","test","file"] Windows: splitDirectories "C:\\test\\file" == ["C:\\", "test", "file"] Valid x => joinPath (splitDirectories x) `equalFilePath` x splitDirectories "" == [] Windows: splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"] splitDirectories "/test///file" == ["/","test","file"] !Join path elements back together. joinPath a == foldr () "" a joinPath ["/","directory/","file.ext"] == "/directory/file.ext" Valid x => joinPath (splitPath x) == x joinPath [] == "" Posix: joinPath ["test","file","path"] == "test/file/path" Equality of two  s. If you call !System.Directory.canonicalizePath first this has a much better chance of working. Note that this doesn't follow symlinks or DOSNAM~1s. Similar to  , this does not expand "..", because of symlinks.  x == y ==> equalFilePath x y normalise x == normalise y ==> equalFilePath x y equalFilePath "foo" "foo/" not (equalFilePath "/a/../c" "/c") not (equalFilePath "foo" "/foo") Posix: not (equalFilePath "foo" "FOO") Windows: equalFilePath "foo" "FOO" Windows: not (equalFilePath "C:" "C:/") Contract a filename, based on a relative path. Note that the resulting path will never introduce ..* paths, as the presence of symlinks means ../b may not reach a/b if it starts from a/c. For a worked example see  http://neilmitchell.blogspot.co.uk/2015/10/filepaths-are-subtle-symlinks-are-hard.htmlthis blog post.The corresponding  makeAbsolute function can be found in System.Directory.  makeRelative "/directory" "/directory/file.ext" == "file.ext" Valid x => makeRelative (takeDirectory x) x `equalFilePath` takeFileName x makeRelative x x == "." Valid x y => equalFilePath x y || (isRelative x && makeRelative y x == x) || equalFilePath (y makeRelative y x) x Windows: makeRelative "C:\\Home" "c:\\home\\bob" == "bob" Windows: makeRelative "C:\\Home" "c:/home/bob" == "bob" Windows: makeRelative "C:\\Home" "D:\\Home\\Bob" == "D:\\Home\\Bob" Windows: makeRelative "C:\\Home" "C:Home\\Bob" == "C:Home\\Bob" Windows: makeRelative "/Home" "/home/bob" == "bob" Windows: makeRelative "/" "//" == "//" Posix: makeRelative "/Home" "/home/bob" == "/home/bob" Posix: makeRelative "/home/" "/home/bob/foo/bar" == "bob/foo/bar" Posix: makeRelative "/fred" "bob" == "bob" Posix: makeRelative "/file/test" "/file/test/fred" == "fred" Posix: makeRelative "/file/test" "/file/test/fred/" == "fred/" Posix: makeRelative "some/path" "some/path/a/b/c" == "a/b/c" Normalise a file)// outside of the drive can be made blank/ ->  ./ -> ""Does not remove "..", because of symlinks. Posix: normalise "/file/\\test////" == "/file/\\test/" Posix: normalise "/file/./test" == "/file/test" Posix: normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/" Posix: normalise "../bob/fred/" == "../bob/fred/" Posix: normalise "/a/../c" == "/a/../c" Posix: normalise "./bob/fred/" == "bob/fred/" Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\" Windows: normalise "c:\\" == "C:\\" Windows: normalise "C:.\\" == "C:" Windows: normalise "\\\\server\\test" == "\\\\server\\test" Windows: normalise "//server/test" == "\\\\server\\test" Windows: normalise "c:/file" == "C:\\file" Windows: normalise "/file" == "\\file" Windows: normalise "\\" == "\\" Windows: normalise "/./" == "\\" normalise "." == "." Posix: normalise "./" == "./" Posix: normalise "./." == "./" Posix: normalise "/./" == "/" Posix: normalise "/" == "/" Posix: normalise "bob/fred/." == "bob/fred/" Posix: normalise "//home" == "/home" Is a FilePath valid, i.e. could you create a file like it? This function checks for invalid names, and invalid characters, but does not check if length limits are exceeded, as these are typically filesystem dependent.  isValid "" == False isValid "\0" == False Posix: isValid "/random_ path:*" == True Posix: isValid x == not (null x) Windows: isValid "c:\\test" == True Windows: isValid "c:\\test:of_test" == False Windows: isValid "test*" == False Windows: isValid "c:\\test\\nul" == False Windows: isValid "c:\\test\\prn.txt" == False Windows: isValid "c:\\nul\\file" == False Windows: isValid "\\\\" == False Windows: isValid "\\\\\\foo" == False Windows: isValid "\\\\?\\D:file" == False Windows: isValid "foo\tbar" == False Windows: isValid "nul .txt" == False Windows: isValid " nul.txt" == True Take a FilePath and make it valid; does not change already valid FilePaths. isValid (makeValid x) isValid x ==> makeValid x == x makeValid "" == "_" makeValid "file\0name" == "file_name" Windows: makeValid "c:\\already\\/valid" == "c:\\already\\/valid" Windows: makeValid "c:\\test:of_test" == "c:\\test_of_test" Windows: makeValid "test*" == "test_" Windows: makeValid "c:\\test\\nul" == "c:\\test\\nul_" Windows: makeValid "c:\\test\\prn.txt" == "c:\\test\\prn_.txt" Windows: makeValid "c:\\test/prn.txt" == "c:\\test/prn_.txt" Windows: makeValid "c:\\nul\\file" == "c:\\nul_\\file" Windows: makeValid "\\\\\\foo" == "\\\\drive" Windows: makeValid "\\\\?\\D:file" == "\\\\?\\D:\\file" Windows: makeValid "nul .txt" == "nul _.txt" /Is a path relative, or is it fixed to the root? Windows: isRelative "path\\test" == True Windows: isRelative "c:\\test" == False Windows: isRelative "c:test" == True Windows: isRelative "c:\\" == False Windows: isRelative "c:/" == False Windows: isRelative "c:" == True Windows: isRelative "\\\\foo" == False Windows: isRelative "\\\\?\\foo" == False Windows: isRelative "\\\\?\\UNC\\foo" == False Windows: isRelative "/foo" == True Windows: isRelative "\\foo" == True Posix: isRelative "test/path" == True Posix: isRelative "/test" == False Posix: isRelative "/" == FalseAccording to [1]:/"A UNC name of any format [is never relative]."6"You cannot use the "\?" prefix with a relative path."  not .  "isAbsolute x == not (isRelative x) The stripSuffix function drops the given suffix from a list. It returns Nothing if the list did not end with the suffix given, or Just the list before the suffix, if it does.5         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!!                                                                                                                                                                                                                                                                                                           {yz| TU[i9                                                                          template-haskellLanguage.Haskell.TH.SyntaxLanguage.Haskell.TH.Lib Language.Haskell.TH.Lib.InternalLanguage.Haskell.TH.Quote&Language.Haskell.TH.LanguageExtensionsLanguage.Haskell.TH.PprLibLanguage.Haskell.TH.PprLanguage.Haskell.TH.CodeDoLanguage.Haskell.TH.Lib.MapSystem.FilePath.Posix75System.FilePathdyn pprPatSynType thisModule$dmlift $dmqRunIO6 $dmppr_listLanguage.Haskell.THSystem.FilePath.Windows sequenceQliftnewNamemkName mkNameG_v mkNameG_d mkNameG_tcmkNameLmkNameSTExpunType unTypeCode liftTyped mkModNameunsafeCodeCoercemkNameQ mkNameG_fldcharLstringLintegerLintPrimL wordPrimL floatPrimL doublePrimL rationalL stringPrimL charPrimL liftStringlitPvarPtupP unboxedTupP unboxedSumPconPinfixPtildePbangPasPwildPrecPlistPsigPviewPtypePinvisPfieldPatmatchclausevarEconElitEappEappTypeEinfixEinfixAppsectionLsectionRlamElamCaseE lamCasesEtupE unboxedTupE unboxedSumEcondEmultiIfEletEcaseEdoEcompEfromE fromThenEfromToE fromThenToElistEsigErecConErecUpdEstaticE unboundVarElabelEimplicitParamVarEmdoE getFieldE projectionEtypeEfieldExpguardedBnormalBnormalGEpatGEbindSletSnoBindSparSrecSfunDvalDdataDnewtypeDtySynDclassDinstanceWithOverlapDsigDforImpDpragInlD pragSpecD pragSpecInlD pragSpecInstD pragRuleDpragAnnD dataFamilyDopenTypeFamilyD dataInstD newtypeInstD tySynInstDclosedTypeFamilyDinfixLWithSpecDinfixRWithSpecDinfixNWithSpecD roleAnnotDstandaloneDerivWithStrategyD defaultSigDpatSynD patSynSigD pragCompleteDimplicitParamBindDkiSigDdefaultD pragOpaqueD typeDataD pragSCCFunDpragSCCFunNamedDcxtnoSourceUnpackednesssourceNoUnpack sourceUnpacknoSourceStrictness sourceLazy sourceStrictnormalCrecCinfixCforallCgadtCrecGadtCbangbangType varBangTypeunidir implBidir explBidir prefixPatSyn infixPatSyn recordPatSynforallT forallVisTvarTconTtupleT unboxedTupleT unboxedSumTarrowTlistTappTappKindTsigT equalityTlitT promotedTpromotedTupleT promotedNilT promotedConsT wildCardTimplicitParamTinfixTnumTyLitstrTyLit charTyLitplainTVkindedTVnominalRrepresentationalRphantomRinferRstarK constraintKnoSigkindSigtyVarSiginjectivityAnncCallstdCallcApiprim javaScriptunsafesafe interruptiblefunDep mulArrowTtySynEqn QuasiQuoterquoteExpquotePatquoteDec quoteTyperuleVar typedRuleVar plainInvisTV kindedInvisTV plainBndrTV kindedBndrTVvalueAnnotationtypeAnnotationmoduleAnnotation derivClause specifiedSpec inferredSpecbndrReq bndrInvisLiftQuoteExpMatchClauseQExpQPatStmtConTypeQTypeDecBangType VarBangTypeFieldExpFieldPatNamePatQFunDepPred TyVarBndrUnitDecsQRuleBndrTySynEqnRoleInjectivityAnnKindOverlap DerivClause DerivStrategyDecs TyVarBndrSpecCodeModName TyVarBndrVisNoInlineInline InlinableConLikeFunLike AllPhases FromPhase BeforePhase Overlappable OverlappingOverlaps IncoherentNoNamespaceSpecifierTypeNamespaceSpecifierDataNamespaceSpecifier stockStrategyanyclassStrategynewtypeStrategy viaStrategyghc-boot-th-9.10.3-ee58GHC.ForeignSrcLang.TypeForeignSrcLangLangCLangCxxLangObjc LangObjcxxLangAsmLangJs RawObjectGHC.LanguageExtensions.Type ExtensionCppOverlappingInstancesUndecidableInstancesIncoherentInstancesUndecidableSuperClassesMonomorphismRestrictionMonoLocalBindsDeepSubsumptionRelaxedPolyRecExtendedDefaultRulesForeignFunctionInterfaceUnliftedFFITypesInterruptibleFFICApiFFIGHCForeignImportPrim JavaScriptFFIParallelArraysArrowsTemplateHaskellTemplateHaskellQuotes QualifiedDo QuasiQuotesImplicitParamsImplicitPreludeScopedTypeVariablesAllowAmbiguousTypes UnboxedTuples UnboxedSumsUnliftedNewtypesUnliftedDatatypes BangPatterns TypeFamiliesTypeFamilyDependencies TypeInTypeOverloadedStringsOverloadedLists NumDecimalsDisambiguateRecordFieldsRecordWildCardsNamedFieldPuns ViewPatternsGADTs GADTSyntaxNPlusKPatternsDoAndIfThenElseBlockArgumentsRebindableSyntaxConstraintKinds PolyKinds DataKindsTypeData InstanceSigs ApplicativeDo LinearTypesRequiredTypeArgumentsStandaloneDerivingDeriveDataTypeableAutoDeriveTypeable DeriveFunctorDeriveTraversableDeriveFoldable DeriveGenericDefaultSignaturesDeriveAnyClass DeriveLiftDerivingStrategies DerivingViaTypeSynonymInstancesFlexibleContextsFlexibleInstancesConstrainedClassMethodsMultiParamTypeClassesNullaryTypeClassesFunctionalDependencies UnicodeSyntaxExistentialQuantification MagicHashEmptyDataDeclsKindSignaturesRoleAnnotationsParallelListCompTransformListCompMonadComprehensionsGeneralizedNewtypeDeriving RecursiveDoPostfixOperators TupleSections PatternGuardsLiberalTypeSynonyms RankNTypesImpredicativeTypes TypeOperatorsExplicitNamespacesPackageImportsExplicitForAllAlternativeLayoutRule!AlternativeLayoutRuleTransitionalDatatypeContextsNondecreasingIndentation RelaxedLayoutTraditionalRecordSyntax LambdaCase MultiWayIfBinaryLiteralsNegativeLiteralsHexFloatLiteralsDuplicateRecordFieldsOverloadedLabels EmptyCasePatternSynonymsPartialTypeSignaturesNamedWildCardsStaticPointersTypeApplicationsStrict StrictDataEmptyDataDerivingNumericUnderscoresQuantifiedConstraints StarIsTypeImportQualifiedPostCUSKsStandaloneKindSignaturesLexicalNegationFieldSelectorsOverloadedRecordDotOverloadedRecordUpdateTypeAbstractionsExtendedLiterals ListTuplePunsDocLoc ModuleDocDeclDocArgDocInstDoc AnnLookupAnnLookupModule AnnLookupNameNominalRRepresentationalRPhantomRInferRTyLitNumTyLitStrTyLit CharTyLitFamilyResultSigNoSigKindSigTyVarSigBndrVisBndrReq BndrInvis TyVarBndrPlainTVKindedTV Specificity SpecifiedSpec InferredSpecForallT ForallVisTAppTAppKindTSigTVarTConT PromotedTInfixTUInfixTPromotedInfixTPromotedUInfixTParensTTupleT UnboxedTupleT UnboxedSumTArrowT MulArrowT EqualityTListTPromotedTupleT PromotedNilT PromotedConsTStarT ConstraintTLitT WildCardTImplicitParamT PatSynArgs PrefixPatSyn InfixPatSyn RecordPatSyn PatSynDirUnidir ImplBidir ExplBidir VarStrictType StrictTypeBangNormalCRecCInfixCForallCGadtCRecGadtCDecidedStrictness DecidedLazy DecidedStrict DecidedUnpackSourceStrictnessNoSourceStrictness SourceLazy SourceStrictSourceUnpackednessNoSourceUnpackednessSourceNoUnpack SourceUnpackCxt AnnTargetModuleAnnotationTypeAnnotationValueAnnotationRuleVar TypedRuleVarPhases RuleMatchPragmaInlinePOpaqueP SpecialisePSpecialiseInstPRulePAnnPLineP CompletePSCCPSafetyUnsafeSafe InterruptibleCallconvCCallStdCallCApiPrim JavaScriptForeignImportFExportFTypeFamilyHead PatSynType StockStrategyAnyclassStrategyNewtypeStrategy ViaStrategyNamespaceSpecifierFunDValDDataDNewtypeD TypeDataDTySynDClassD InstanceDSigDKiSigDForeignDInfixDDefaultDPragmaD DataFamilyD DataInstD NewtypeInstD TySynInstDOpenTypeFamilyDClosedTypeFamilyD RoleAnnotDStandaloneDerivD DefaultSigDPatSynD PatSynSigDImplicitParamBindDRangeFromR FromThenRFromToR FromThenToRBindSLetSNoBindSParSRecSGuardNormalGPatGBodyGuardedBNormalBVarEConELitEAppEAppTypeEInfixEUInfixEParensELamELamCaseE LamCasesETupE UnboxedTupE UnboxedSumECondEMultiIfELetECaseEDoEMDoECompE ArithSeqEListESigERecConERecUpdEStaticE UnboundVarELabelEImplicitParamVarE GetFieldE ProjectionE TypedBracketE TypedSpliceETypeELitPVarPTupP UnboxedTupP UnboxedSumPConPInfixPUInfixPParensPTildePBangPAsPWildPRecPListPSigPViewPTypePInvisPBytes bytesSize bytesOffsetbytesPtrLitCharLStringLIntegerL RationalLIntPrimL WordPrimL FloatPrimL DoublePrimL StringPrimL BytesPrimL CharPrimLFixityDirectionInfixLInfixRInfixNFixity InstanceDecUnliftedAritySumAritySumAlt ParentName ModuleInfoInfoClassIClassOpITyConIFamilyI PrimTyConIDataConIPatSynIVarITyVarICharPosLocloc_end loc_start loc_module loc_package loc_filenameNameIsAloneAppliedInfixUniq NameSpaceVarNameDataName TcClsNameFldName fldParent NameFlavourNameSNameQNameUNameLNameGOccNameModulePkgName examineCodeunQQuasiqNewNameqReportqRecover qLookupNameqReify qReifyFixity qReifyTypeqReifyInstances qReifyRolesqReifyAnnotations qReifyModuleqReifyConStrictness qLocationqRunIOqGetPackageRootqAddDependentFile qAddTempFile qAddTopDeclsqAddForeignFilePathqAddModFinalizerqAddCorePluginqGetQqPutQ qIsExtEnabled qExtsEnabledqPutDocqGetDocmemcmp newNameIObadIOcounterrunQunTypeQunsafeTExpCoerceliftCode hoistCodebindCode bindCode_joinCodereport reportError reportWarningrecover lookupNamelookupTypeNamelookupValueNamereify reifyFixity reifyTypenewDeclarationGroupreifyInstances reifyRolesreifyAnnotations reifyModulereifyConStrictness isInstancelocationrunIOgetPackageRootmakeRelativeToProjectaddDependentFile addTempFile addTopDeclsaddForeignFileaddForeignSourceaddForeignFilePathaddModFinalizer addCorePlugingetQputQ isExtEnabled extsEnabledputDocgetDocaddrToByteArrayNameaddrToByteArraytrueName falseName nothingNamejustNameleftName rightName nonemptyNameoneNamemanyNamedataToQa dataToExpQliftData dataToPatQ modString mkPkgName pkgString mkOccName occStringnameBase nameModule namePackage nameSpacemkNameUmkNameGshowName showName' tupleDataName tupleTypeNameunboxedTupleDataNameunboxedTupleTypeName mk_tup_nameunboxedSumDataNameunboxedSumTypeName maxPrecedence defaultFixityeqBytes compareBytescmpEqthenCmpget_cons_names $fShowName $fOrdName $fQuoteIO $fOrdBytes $fEqBytes $fShowBytes$fLiftSumRepSum7#$fLiftSumRepSum6#$fLiftSumRepSum5#$fLiftSumRepSum4#$fLiftSumRepSum3#$fLiftSumRepSum2#$fLiftTupleRepTuple7#$fLiftTupleRepTuple6#$fLiftTupleRepTuple5#$fLiftTupleRepTuple4#$fLiftTupleRepTuple3#$fLiftTupleRepTuple2#$fLiftTupleRepSolo#$fLiftTupleRepUnit#$fLiftBoxedRepTuple7$fLiftBoxedRepTuple6$fLiftBoxedRepTuple5$fLiftBoxedRepTuple4$fLiftBoxedRepTuple3$fLiftBoxedRepTuple2$fLiftBoxedRepUnit$fLiftBoxedRepVoid$fLiftBoxedRepNonEmpty$fLiftBoxedRepList$fLiftBoxedRepEither$fLiftBoxedRepMaybe$fLiftBoxedRepByteArray$fLiftAddrRepAddr#$fLiftBoxedRepBool$fLiftWordRepChar#$fLiftBoxedRepChar$fLiftDoubleRepDouble#$fLiftBoxedRepDouble$fLiftFloatRepFloat#$fLiftBoxedRepFloat$fLiftBoxedRepRatio$fLiftBoxedRepFixed$fLiftBoxedRepNatural$fLiftBoxedRepWord64$fLiftBoxedRepWord32$fLiftBoxedRepWord16$fLiftBoxedRepWord8$fLiftBoxedRepWord$fLiftWordRepWord#$fLiftBoxedRepInt64$fLiftBoxedRepInt32$fLiftBoxedRepInt16$fLiftBoxedRepInt8$fLiftIntRepInt#$fLiftBoxedRepInt$fLiftBoxedRepInteger$fQuasiQ $fMonadIOQ$fQuoteQ $fMonadFixQ $fMonoidQ $fSemigroupQ$fApplicativeQ $fFunctorQ $fMonadFailQ$fMonadQ $fQuasiIO $fShowDocLoc $fEqDocLoc $fOrdDocLoc $fDataDocLoc$fGenericDocLoc $fShowInfo$fEqInfo $fOrdInfo $fDataInfo $fGenericInfo $fShowDec$fEqDec$fOrdDec $fDataDec $fGenericDec$fShowPatSynDir $fEqPatSynDir$fOrdPatSynDir$fDataPatSynDir$fGenericPatSynDir $fShowClause $fEqClause $fOrdClause $fDataClause$fGenericClause $fShowBody$fEqBody $fOrdBody $fDataBody $fGenericBody $fShowGuard $fEqGuard $fOrdGuard $fDataGuard$fGenericGuard $fShowStmt$fEqStmt $fOrdStmt $fDataStmt $fGenericStmt $fShowExp$fEqExp$fOrdExp $fDataExp $fGenericExp $fShowRange $fEqRange $fOrdRange $fDataRange$fGenericRange $fShowMatch $fEqMatch $fOrdMatch $fDataMatch$fGenericMatch $fShowPat$fEqPat$fOrdPat $fDataPat $fGenericPat $fShowPragma $fEqPragma $fOrdPragma $fDataPragma$fGenericPragma$fShowDerivClause$fEqDerivClause$fOrdDerivClause$fDataDerivClause$fGenericDerivClause$fShowDerivStrategy$fEqDerivStrategy$fOrdDerivStrategy$fDataDerivStrategy$fGenericDerivStrategy$fShowTySynEqn $fEqTySynEqn $fOrdTySynEqn$fDataTySynEqn$fGenericTySynEqn $fShowForeign $fEqForeign $fOrdForeign $fDataForeign$fGenericForeign$fShowRuleBndr $fEqRuleBndr $fOrdRuleBndr$fDataRuleBndr$fGenericRuleBndr $fShowCon$fEqCon$fOrdCon $fDataCon $fGenericCon$fShowTypeFamilyHead$fEqTypeFamilyHead$fOrdTypeFamilyHead$fDataTypeFamilyHead$fGenericTypeFamilyHead$fShowFamilyResultSig$fEqFamilyResultSig$fOrdFamilyResultSig$fDataFamilyResultSig$fGenericFamilyResultSig $fShowType$fEqType $fOrdType $fDataType $fGenericType$fShowTyVarBndr $fEqTyVarBndr$fOrdTyVarBndr$fDataTyVarBndr$fGenericTyVarBndr$fFunctorTyVarBndr$fFoldableTyVarBndr$fTraversableTyVarBndr$fShowAnnLookup $fEqAnnLookup$fOrdAnnLookup$fDataAnnLookup$fGenericAnnLookup $fShowRole$fEqRole $fOrdRole $fDataRole $fGenericRole $fShowTyLit $fEqTyLit $fOrdTyLit $fDataTyLit$fGenericTyLit$fShowInjectivityAnn$fEqInjectivityAnn$fOrdInjectivityAnn$fDataInjectivityAnn$fGenericInjectivityAnn $fShowBndrVis $fEqBndrVis $fOrdBndrVis $fDataBndrVis$fGenericBndrVis$fShowSpecificity$fEqSpecificity$fOrdSpecificity$fDataSpecificity$fGenericSpecificity$fShowPatSynArgs$fEqPatSynArgs$fOrdPatSynArgs$fDataPatSynArgs$fGenericPatSynArgs $fShowBang$fEqBang $fOrdBang $fDataBang $fGenericBang$fShowDecidedStrictness$fEqDecidedStrictness$fOrdDecidedStrictness$fDataDecidedStrictness$fGenericDecidedStrictness$fShowSourceStrictness$fEqSourceStrictness$fOrdSourceStrictness$fDataSourceStrictness$fGenericSourceStrictness$fShowSourceUnpackedness$fEqSourceUnpackedness$fOrdSourceUnpackedness$fDataSourceUnpackedness$fGenericSourceUnpackedness$fShowAnnTarget $fEqAnnTarget$fOrdAnnTarget$fDataAnnTarget$fGenericAnnTarget $fShowPhases $fEqPhases $fOrdPhases $fDataPhases$fGenericPhases$fShowRuleMatch $fEqRuleMatch$fOrdRuleMatch$fDataRuleMatch$fGenericRuleMatch $fShowInline $fEqInline $fOrdInline $fDataInline$fGenericInline $fShowSafety $fEqSafety $fOrdSafety $fDataSafety$fGenericSafety$fShowCallconv $fEqCallconv $fOrdCallconv$fDataCallconv$fGenericCallconv $fShowFunDep $fEqFunDep $fOrdFunDep $fDataFunDep$fGenericFunDep $fShowOverlap $fEqOverlap $fOrdOverlap $fDataOverlap$fGenericOverlap$fShowNamespaceSpecifier$fEqNamespaceSpecifier$fOrdNamespaceSpecifier$fDataNamespaceSpecifier$fGenericNamespaceSpecifier $fShowLit$fEqLit$fOrdLit $fDataLit $fGenericLit $fDataBytes$fGenericBytes $fEqFixity $fOrdFixity $fShowFixity $fDataFixity$fGenericFixity$fEqFixityDirection$fOrdFixityDirection$fShowFixityDirection$fDataFixityDirection$fGenericFixityDirection$fShowModuleInfo$fEqModuleInfo$fOrdModuleInfo$fDataModuleInfo$fGenericModuleInfo $fShowLoc$fEqLoc$fOrdLoc $fDataLoc $fGenericLoc $fDataName$fEqName $fGenericName$fDataNameFlavour$fEqNameFlavour$fOrdNameFlavour$fShowNameFlavour$fGenericNameFlavour $fEqNameSpace$fOrdNameSpace$fShowNameSpace$fDataNameSpace$fGenericNameSpace $fShowOccName $fEqOccName $fOrdOccName $fDataOccName$fGenericOccName $fShowModule $fEqModule $fOrdModule $fDataModule$fGenericModule $fShowPkgName $fEqPkgName $fOrdPkgName $fDataPkgName$fGenericPkgName $fShowModName $fEqModName $fOrdModName $fDataModName$fGenericModName quoteFileDocPprMpprNamepprName' to_HPJ_DocisEmptyemptysemicommacolondcolonspaceequalsarrowlparenrparenlbrackrbracklbracerbracetextptextcharintintegerfloatdoublerationalparensbracketsbracesquotes doubleQuotes<>hcat<+>hsep$$$+$vcatcatsepfcatfsepnesthang punctuate $fMonadPprM$fApplicativePprM $fFunctorPprM $fShowPprMPprFlag pprTyVarBndrTypeArgTANormalTyArg ForallVisFlag ForallVis ForallInvisPprpprppr_list Precedence nestDepthappPrecopPrecunopPrecfunPrecqualPrecsigPrecnoPrecparensIfpprintppr_sig pprFixitypprNamespaceSpecifier pprPatSynSig pprPrefixOccisSymOcc pprInfixExppprExp pprFields pprMaybeExp pprMatchPat pprGuardedpprBody pprClausepprLit bytesToString pprStringpprPatppr_decppr_deriv_strategy ppr_overlapppr_data ppr_newtype ppr_type_data ppr_typedefppr_deriv_clause ppr_tySyn ppr_tf_head ppr_bndrscommaSepApplied pprForall pprForallVis pprForall' pprRecFields pprGadtRHSpprVarBangType pprBangTypepprVarStrictType pprStrictTypepprType pprParendType pprInfixTpprParendTypeArgisStarTpprTyApp fromTANormal pprFunArgTypesplitpprTyLit pprBndrVispprCxt ppr_cxt_preds where_clause showtextl hashParens quoteParenssepWithcommaSep commaSepWithsemiSep semiSepWithunboxedSumBarsbar$fPprLoc $fPprRange $fPprRole $fPprTyLit $fPprType$fPprDecidedStrictness$fPprSourceStrictness$fPprSourceUnpackedness $fPprBang$fPprPatSynArgs$fPprPatSynDir$fPprCon $fPprClause $fPprRuleBndr $fPprPhases$fPprRuleMatch $fPprInline $fPprPragma $fPprForeign$fPprInjectivityAnn$fPprFamilyResultSig $fPprFunDep$fPprDec$fPprPat$fPprLit $fPprMatch $fPprStmt$fPprExp$fPprModuleInfo $fPprModule $fPprInfo $fPprName $fPprList $fPprTypeArg$fPprTyVarBndr$fPprFlagBndrVis$fPprFlagSpecificity $fPprFlagUnit$fShowForallVisFlagDerivStrategyQFamilyResultSigQ PatSynArgsQ PatSynDirQ TySynEqnQ RuleBndrQ FieldExpQVarStrictTypeQ StrictTypeQ VarBangTypeQ BangTypeQBangQSourceUnpackednessQSourceStrictnessQRangeQStmtQGuardQBodyQClauseQMatchQ DerivClauseQPredQCxtQTyLitQKindQConQDecQ FieldPatQInfoQCodeQTExpQ bytesPrimLuInfixPparensPfromR fromThenRfromToR fromThenToRnormalGpatGparensEuInfixElam1E arithSeqEstringE typedSpliceE typedBracketE instanceDinfixLDinfixRDinfixND pragLineDstandaloneDerivDuInfixTpromotedInfixTpromotedUInfixTparensTclassPequalPisStrict notStrictunpacked strictType varStrictTypevarKconKtupleKarrowKlistKappKappsE withDecDoc withDecsDocfunD_doc dataD_doc newtypeD_doc typeDataD_doc dataInstD_docnewtypeInstD_doc patSynD_docdocConsDefaultBndrFlagdefaultBndrFlagmkBytes$fDefaultBndrFlagBndrVis$fDefaultBndrFlagSpecificity$fDefaultBndrFlagUnit>>=>>insertlookupMapisPosix isWindows pathSeparatorpathSeparatorsisPathSeparatorsearchPathSeparatorisSearchPathSeparator extSeparatorisExtSeparatorsplitSearchPath getSearchPath ghc-internalGHC.Internal.IOFilePathsplitExtension addExtension takeExtension-<.>replaceExtension<.> dropExtension hasExtension isExtensionOfstripExtensionGHC.Internal.MaybeNothingJustdropExtensionssplitExtensionstakeExtensionsreplaceExtensionsisLetter splitDrive joinDrive takeDrive dropDrivehasDriveisDrive splitFileNamereplaceFileName dropFileName takeDirectory takeFileName takeBaseNamereplaceBaseNamehasTrailingPathSeparatoraddTrailingPathSeparatordropTrailingPathSeparatorreplaceDirectorycombine combineAlways splitPathsplitDirectoriesjoinPath equalFilePath normalise makeRelativeisValid makeValid isRelative isAbsolute stripSuffixMaybeghc-primGHC.PrimAddr#GHC.Internal.Control.Monad.Failfail GHC.ClassesEqGHC.Internal.ShowShowGHC.Internal.BaseStringGHC.Internal.Data.DataDataGHC.Internal.Control.Monad.FixmfixGHC.Internal.IO.ExceptionFixIOException GHC.TypesTrue