ryanucode / firebase-effect-manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firebase Push ID Generator Toy App

This is an elm implementation of the Firebase unique ID generation algorithm

Current State

Key.elm is now a working effect manager. It is largely a clone of Random.

Main.elm is a toy interface to help quickly debug.

Reasoning for Using an Effect Manager

Currently the code in Key.elm does work provided you pass the Seed generated by Random.step into the model of your host application. This Key library will ultimately be used as a part of a much larger firebase library that has, thus far, avoided inserting update messages, states, and subscriptions into the host application.

The reason this is incompatible with the existing Random.generate implementation is there is a time sensitive part of the key. The elm Time library uses Tasks while the Random library uses its own types. You cannot make a randomly generated string that has a time dependent component due to the inability to compose the types generated by these libraries.

The seed used by this SHOULD be a global state and calling Key.generate SHOULD cause global side effects by updating that key. It is not ideal for there to be a potential data race in the host application that may cause duplicate "random" parts of these firebase keys.

About


Languages

Language:Elm 100.0%