# Option type compatible with comprehensions in Elixr?

**URL:** <https://forum.devtalk.com/t/option-type-compatible-with-comprehensions-in-elixr/40904>\
**Category:** Backend Questions/Help\
**Tags:** elixir, functional-programming\
**Created:** [16 February 2022 10:32 UTC](https://forum.devtalk.com/t/option-type-compatible-with-comprehensions-in-elixr/40904 "2022-02-16T10:32:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![OvermindDL1](https://forum.devtalk.com/user_avatar/forum.devtalk.com/overminddl1/32/52_2.png) [@OvermindDL1](https://forum.devtalk.com/u/OvermindDL1)\
**Post date:** [17 February 2022 15:37 UTC](https://forum.devtalk.com/t/option-type-compatible-with-comprehensions-in-elixr/40904/3 "2022-02-17T15:37:30Z")

</div>

1. Yes, or with `with` if you want an else, but you’ll want to make the tagged typed be `ok: value` and `error: reason` (which is closer to a result type, but it’s a limitation of elixir tuple lists in that they are always tuples). Traditionally `{:ok, value}` and `:error` is the “option” type in Elixir, where `{:ok, value}` and `{:error, reason}` is the “result” type in Elixir.

2. Oh yes, quite a lot, I’m personally a fan of [expede’s libraries](https://hex.pm/orgs/witchcrafters) if you want the full haskell/scala like interfaces. There is also another library made by the same author (not at that link) that is more simple and just works with the usual elixir/erlang forms as well.

---

_[View the full topic](https://forum.devtalk.com/t/option-type-compatible-with-comprehensions-in-elixr/40904)._
