Preview image
elm-review-todo-it-for-me
Released on 2021-07-23

An elm-review rule designed to take code that looks like this

import Codec

type MyType = { fieldA : Int, fieldB : Int }

myTypeCodec : Codec MyType
myTypeCodec = Debug.todo ""

and replace it with this

import Codec

type MyType = { fieldA : Int, fieldB : Int }

myTypeCodec : Codec MyType
myTypeCodec = 
    Codec.object MyType
        |> Codec.field "fieldA" .fieldA Codec.int
        |> Codec.field "fieldB" .fieldB Codec.string
        |> Codec.buildObject

And not just codecs, but generate code for a variety of different types and allow the user to easily set up their own code gen.

I called it elm-review-todo-it-for-me because I write Debug.todo and then it does it for me. Very clever. Also a terrible awful name.

After I demoed a proof of concept, gampleman started helping me work on it. After I while I lost interest but he kept at it. Eventually I just transferred control of the repo to him and he gave it a much better name: elm-review-derive.