restartable: Minimal live coding library for model-view-event-update applications.

[ bsd3, control, library ] [ Propose Tags ]

Minimal live coding library. It can store model of the model-view-event-update applications. It uses FromJSON and ToJSON with default value for absent data elements, and Generic parser otherwise:

import Initially(initially, Initial)

data MyModel = Model { timestamp :: UTCTime }

instance ToJSON MyModel where
instance FromJSON MyModel where
  parseJSON = initially myDefaultValue
instance Initial MyModel

main = restartable myMain

It is preferred to attach initial value to every substructure, so whenever it fails to parse the remaining part of the state is still parsed correctly.

See https://github.com/mjgajda/restartable#readme


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.3.0.0
Change log ChangeLog.md
Dependencies aeson (>=1.4.7.1 && <1.5), base (>=4.7 && <5), bytestring (>=0.10.10.1 && <0.11), unix (>=2.7.2.2 && <2.8) [details]
License BSD-3-Clause
Copyright '2020
Author Michał J. Gajda
Maintainer mjgajda@migamake.com
Category Control
Home page https://github.com/mgajda/restartable#readme
Bug tracker https://github.com/mgajda/restartable/issues
Source repo head: git clone https://github.com/mgajda/restartable
Uploaded by MichalGajda at 2020-11-09T13:20:41Z
Distributions
Downloads 356 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for restartable-0.3.0.0

[back to package description]

Minimal live coding library for model-view-event-update applications.

Minimal live coding library. It can store model of the model-view-event-update applications. It uses FromJSON and ToJSON with default value for absent data elements, and Generic parser otherwise:

import Control.Restartable.Initially(initially, Initial)

data MyModel = Model { timestamp :: UTCTime }

instance ToJSON MyModel where
instance FromJSON MyModel where
  parseJSON = initially myDefaultValue
instance Initial MyModel

Then in the main module use:

import Control.Restartable.Checkpoint(restartable, Ending(..))

main = restartable "checkpoint.save" myMain

myMain :: MyModel -> IO (MyModel, Ending)

It is preferred to attach initial value to every substructure, so whenever it fails to parse the remaining part of the state is still parsed correctly.