Cabal-1.22.5.0: A framework for packaging Haskell software

Copyright | Duncan Coutts 2008
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Distribution.ModuleName

Description

Data type for Haskell module names.

Synopsis

- data ModuleName
- fromString :: String -> ModuleName
- components :: ModuleName -> [String]
- toFilePath :: ModuleName -> FilePath
- main :: ModuleName
- simple :: String -> ModuleName

# Documentation

data ModuleName

A valid Haskell module name.

Instances

Eq ModuleName |
Data ModuleName |
Ord ModuleName |
Read ModuleName |
Show ModuleName |
Generic ModuleName |
Binary ModuleName |
Text ModuleName |
type Rep ModuleName |

fromString :: String -> ModuleName

Construct a `ModuleName` from a valid module name `String`.

This is just a convenience function intended for valid module strings. It is an error if it is used with a string that is not a valid module name. If you are parsing user input then use `simpleParse` instead.

components :: ModuleName -> [String]

The individual components of a hierarchical module name. For example

    components (fromString "A.B.C") = ["A", "B", "C"]

toFilePath :: ModuleName -> FilePath

Convert a module name to a file path, but without any file extension. For example:

    toFilePath (fromString "A.B.C") = "A/B/C"

main :: ModuleName

The module name `Main`.

simple :: String -> ModuleName

Deprecated: use ModuleName.fromString instead