Skip to content

Instantly share code, notes, and snippets.

@EduardoRFS
Last active March 1, 2021 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EduardoRFS/026251d7da275132f491eff1dc5174cd to your computer and use it in GitHub Desktop.
Save EduardoRFS/026251d7da275132f491eff1dc5174cd to your computer and use it in GitHub Desktop.
  • remove caml_exn_Division_by_zero when it cannot happen, like a / (a * a)

  • perhaps generalize it to knowing that a number is positive not operating on it

  • do simple math inside of big functions

  • try to optimize x |> map() |> map()

  • search module String on https://ocaml.janestreet.com/ocaml-core/latest/doc/base/Base/

  • check to see if it inlines | x when is(x) and is is another pattern matching

  • typechecker should try to ensure value when dealing with records, there is no need to open a module for that

  • remove inner closures without any reference

  • let.some (_, _, name, received_value_type, index) =List.nth_opt(variable_table, table_index); no warning even if not used on index

  • abstract types leads to this being generic https://github.com/ocaml/ocaml/blob/trunk/lambda/translprim.ml#L538

  • deep types inference, Operation.Side_chain. could be omitted in the following code

    apply_side_chain(
      state,
      Signed.sign(
        ~key,
        Operation.Side_chain.{
          nonce: 0l,
          block_height: 0L,
          source,
          amount: Amount.of_int(5),
          kind: Freeze,
        },
      ),
    )
    
- if `x |> List.exists(f)` fails to typecheck try `List.exists(x, f)` with the reversed signature, this especially true with records inference in `f`

- warnings ocaml both branches are equal `x ? [] : []`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment