Skip to content
An idiomatic Elixir wrapper for gen_statem in OTP 19 (and above).
Branch: master
Clone or download
Latest commit d51de11 Apr 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib v2.0.5 Jan 16, 2019
test Update logger translator to work with OTP21 (#17) Aug 14, 2018
.gitignore Initial commit. May 31, 2016
.travis.yml Fix matrix excludes Jan 15, 2019 v2.0.5 Jan 16, 2019
LICENSE Update URLs May 12, 2018
mix.exs v2.0.5 Jan 16, 2019

Build Status


An idiomatic Elixir wrapper for gen_statem in OTP 19 (and above).

Full documentation is available here.

You can find the package on Hex here.

One important difference between gen_statem and this wrapper is that you declare your callback mode as part of use GenStateMachine in this wrapper, rather than returning it from callback_mode/0 on OTP 19.1 and up, or your init/1 and code_change/4 on versions of OTP prior to 19.1. In versions of OTP prior to 19.1, you can still, however, switch callback modes in code_change/4 by returning a callback mode.

Other than that (and the usual automatically-defined default callbacks as a result of use-ing GenStateMachine), this wrapper does not make any functional alterations.

This wrapper also provides a OTP error translator for Logger, which is automatically added when the :gen_state_machine application is started. Optionally, you may add :gen_state_machine to :included_applications rather than :applications as indicated below if you do not want the translator to be added to Logger.


  1. Add gen_state_machine to your list of dependencies in mix.exs:
def deps do
  [{:gen_state_machine, "~> 2.0"}]
  1. Ensure gen_state_machine is added to your applications:
def application do
  [applications: [:gen_state_machine]]

Special Thanks

I would like to give special thanks to @fishcakez and @michalmuskala, who both provided invaluable feedback on this library!

You can’t perform that action at this time.