Coder Social home page Coder Social logo

Abstract type support? about milk HOT 5 CLOSED

wpcarro avatar wpcarro commented on August 29, 2024
Abstract type support?

from milk.

Comments (5)

wpcarro avatar wpcarro commented on August 29, 2024

By the way, the StringMap.t was created using what I understand to be OCaml's "module functors":

module StringMap = Map.Make(String);

This is my attempt at getting a general purpose dictionary. I suppose I could also model it as:

type KeywordList('a) = list(("string", 'a))

but I'd rather not since I'll get O(n) performance instead of the log n offered by Map.

from milk.

jaredly avatar jaredly commented on August 29, 2024

abstract types are definitely supported, but I imagine the error message could be better. Here's an example types.json where "helpers" is provided
https://github.com/jaredly/veoluz/blob/master/types.json#L6
and the TypeHelpers.re that provides serialization and deserialization for the abstract type https://github.com/jaredly/veoluz/blob/master/ui/TypeHelpers.re

from milk.

wpcarro avatar wpcarro commented on August 29, 2024

Thanks for sharing this. So is the advice to add "TypeHelpers" to my types.json file?

from milk.

jaredly avatar jaredly commented on August 29, 2024

yup! And for the abstract type that you want to support, add manual serialization & deserialization functions. (the example there is for Belt's String Set and String Map)

from milk.

wpcarro avatar wpcarro commented on August 29, 2024

Excellent! Thanks, @jaredly! And thanks for such a great library. As I get more comfortable in this ecosystem, I'd love to contribute.

from milk.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.