fsmActions-0.4.1: Finite state machines and FSM actionsSource codeContentsIndex
Data.FsmActions.IO
Description

High-level input/output interface for finite state machines.

This module allows one to load and save FSMs, where the format to be used may be either explicitly specified, or guessed according to the filename's extension.

Synopsis
data FsmIO
= FsmActionMatrices
| FsmEdges
| FsmMatrix
fsmFormats :: FilePath -> [FsmIO]
loadFsm :: FilePath -> [FsmIO] -> IO (Either FsmError (FSM String))
saveFsm :: FSM String -> FilePath -> Maybe FsmIO -> IO ()
Documentation
data FsmIO Source
Known FSM I/O formats.
Constructors
FsmActionMatricesActionMatrix format: use loadActionMxFsm and saveActionMxFsm; filename extensions: actions, actionspec, actionmxs, actionmatrices, fsmactions.
FsmEdgesFsmEdges format: use loadFsmEdges and saveFsmEdges; filename extensions: edges, fsmedges, graph, mathematica.
FsmMatrixFsmMatrix format: use loadFsmMx and saveFsmMx; filename extensions: mx, matrix, fsmmx, fsmmatrix, fsm.
show/hide Instances
fsmFormats :: FilePath -> [FsmIO]Source
Given a path, return a list of all FsmIO formats, with guesses (according to the file extension) at the front.
loadFsm :: FilePath -> [FsmIO] -> IO (Either FsmError (FSM String))Source

Read an FSM from a file. If the user specifies any FsmIO formats, try each of those in turn; otherwise, try every format known, using the filename extension to guess which to try first.

The returned value is either the resultant FSM, or the error message produced by trying to load it with the _first_ format (so in the case of guessing formats, if the guess is wrong and the file is corrupt, you might get an unhelpful error message).

saveFsm :: FSM String -> FilePath -> Maybe FsmIO -> IO ()Source
Save an FSM to a file. If the user specifies an FsmIO format, it is used; otherwise, it is guessed from the filename extension (and failing that, the first guess, ie FsmActionMatrices, is used).
Produced by Haddock version 2.6.0