Safe HaskellSafe-Inferred

Lab3Help

Synopsis

Documentation

data BStop

Description of a bus stop.

Constructors

BStop 

Fields

name :: String

The bus stop's name.

position :: (Integer, Integer)

Coordinates (x, y).

Invariant: The coordinates range from 0 to 1000.

Instances

Show BStop 

data BLineTable

Description of a bus line.

Constructors

BLineTable 

Fields

lineNumber :: Integer

The line number.

stops :: [BLineStop]

Bus stops (in the order in which they are visited).

Invariant: The list contains at least one element.

Instances

Show BLineTable 

data BLineStop

Description of a bus stop, as part of a bus line.

Constructors

BLineStop 

Fields

stopName :: String

The bus stop's name.

time :: Integer

The travel time (in minutes) from the previous bus stop.

Invariant: A non-negative number, 0 if this is the first stop.

Instances

Show BLineStop 

readStops :: FilePath -> IO (Either String [BStop])

Tries to read a list of bus stops from the given file. If an error is encountered, then an error message is returned (Left msg).

readLines :: FilePath -> IO (Either String [BLineTable])

Tries to read information about bus lines from the given file. If an error is encountered, then an error message is returned (Left msg).