spacecookie-1.0.0.2: Gopher server library and daemon
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Gopher.Util.Gophermap

Description

This module implements a parser for gophermap files.

Example usage:

import Network.Gopher.Util.Gophermap
import qualified Data.ByteString as B
import Data.Attoparsec.ByteString

main = do
  file <- B.readFile "gophermap"
  print $ parseOnly parseGophermap file
Synopsis

Documentation

parseGophermap :: Parser Gophermap Source #

Attoparsec Parser for the gophermap file format

data GophermapEntry Source #

A gophermap entry makes all values of a gopher menu item optional except for file type and description. When converting to a GopherMenuItem, appropriate default values are used.

Constructors

GophermapEntry GopherFileType ByteString (Maybe GophermapFilePath) (Maybe ByteString) (Maybe Integer)

file type, description, path, server name, port number

data GophermapFilePath Source #

Wrapper around RawFilePath to indicate whether it is relative or absolute.

Constructors

GophermapAbsolute RawFilePath

Absolute path starting with /

GophermapRelative RawFilePath

Relative path

GophermapUrl RawFilePath

URL to another protocol starting with URL:

gophermapToDirectoryResponse :: RawFilePath -> Gophermap -> GopherResponse Source #

Given a directory and a Gophermap contained within it, return the corresponding gopher menu response.