slouchpie
Money libraries - which do you use and why?
There seem to be 2 Elixir “Money” libs:
- GitHub - elixirmoney/money: Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog. · GitHub
- GitHub - ex-money/money: Elixir implementation of Money with Currency · GitHub
and neither one makes reference to the other.
Personally, I use the kipcole9 one, a.k.a :ex_money because it seems to be more well-considered (it uses :cldr_utils) and the author is very active here (Ex_money - money with currency type).
However, my library of choice is “less popular” (less stars and forks) on Github.
So I am wondering what other people think. Is one library better than the other? Is it bad to have 2 competing libraries doing much the same thing? Is it possible to achieve approximate consensus on which library deserves to be the de-facto money library for Elixir?
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hi everyone :waving_hand:
Posting here to showcase and announce that Metamorphic is now officially live on a public-facing domain at htt...
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses:
I had hope...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #elixirconf-us
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security











First 10 of 14 Posts!
egze
I remember that
kipcole9/moneytook much more time to compile and we replaced it with plain Decimal. Decimal — Decimal v3.1.1I used
elixirmoney/moneyalso before and it just worked.slouchpie
kipcole9/moneytakes more time to compile because of:cldr. As per the docsWhen using just
:decimal, did you find it hard to account for all of these: GitHub - ex-money/money: Elixir implementation of Money with Currency · GitHub Personally I am unable to bear the mental burden of keeping these things in mind when working with money so that’s why I use:ex_money, a.k.a.kipcole9/money.egze
Yepp, I read it. Our use case was quite simple, so we were fine.
LostKobrakai
My take is that the
:moneylibrary is mostly providing a datatype, while:ex_moneyis a toolkit of dealing with money, especially in an internationalized fashion.Some of those factors:
In
:moneythe list of currencies is static/hardcoded and you can only add additional ones.:ex_moneydepends on:cldrfor currencies instead of maintaining a list on it’s own and also has means for adding additional ones.With
:cldrin the back:ex_cldrdoes not only know the number of decimal places a currency uses, but also about things like alternate rounding rules, like when cash is supposed to round differently than e.g. accounting.:moneydoes only support a single set of default formatting or customized per API call.:ex_moneyagain uses:cldrto adjust formatting to settings matching a certain locale (like the users’).So all in all it’s
:ex_moneyfor me if only for the fact of harnessing the knowledge of a unicode maintained database of those mentioned things as opposed to a library maintainer having a (likely worse) maintained copy of it.slouchpie
This is a good summary of the main differences between the 2 libs.
I think this should be made clear in the Github READMEs of both libs.
strzibny
I use GitHub - elixirmoney/money: Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog. · GitHub together with GitHub - jshmrtn/currency-conversion: Convert Money Amounts between currencies. · GitHub.
I also contributed to both. They are well written, actively maintained and the authors were helpful. What more do you need?
slouchpie
Thank you for contributing to the conversation (and to those libraries!).
For me, I like to keep my apps globally applicable, so I care about the use of
:cldrand the ability to configure which locales/countries/currencies my app understands and can work with. Moreover, if you want to use cryptocurrencies, it behooves developers to be able to define their own custom currencies.What I am looking for is for the community to confirm that one library is “more correct” or “more comprehensive” than the other. I believe, right now, that
:ex_money, a.k.a.kipcole9/moneyis both more correct and comprehensive and yet has less stars and forks on Github (which might influence new Elixir devs).strzibny
Yes, I think the use of
:cldris an excellent point.Every library can have its users, there does not have to be a more correct one. Is Phoenix the most correct web framework for Elixir?
slouchpie
With that in mind, I think the 2 libs should reference each other. A new Elixir dev visiting github would not know which lib to choose.
mindok
I’m sure the maintainers would appreciate a PR to the readmes (and maybe the docs) to include those references
Last Post!
lukaszsamson
In my company (fintech domain) mostly Decimal as integrates nicely with ecto. The library used to be buggy (I and my coworkers authored a few PRs) but that’s no longer the case. The biggest problem with Decimal now is performance. In case of performance sensitive code we use plain old integers or even NIFs.