{"id":16344,"date":"2017-03-06T12:15:37","date_gmt":"2017-03-06T10:15:37","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=16344"},"modified":"2017-03-03T11:38:31","modified_gmt":"2017-03-03T09:38:31","slug":"understanding-elixir-types","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/","title":{"rendered":"Understanding Elixir Types"},"content":{"rendered":"<p>When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up the way it was or what benefits come from it. Hopefully, I can get you through some of my initial confusion about Elixir types.<\/p>\n<h2>The Why: Message Passing<\/h2>\n<p>My initial confusion came from just trying to dive in after coming from other languages. When I started exploring Elixir, I wasn\u2019t quite clear on what made Elixir different or the tradeoffs in language design that facilitated those differences. I got into the nuts and bolts of those differences in my post about <a href=\"https:\/\/www.webcodegeeks.com\/web-development\/comparing-elixir-go\/\">comparing Elixir and Go<\/a>, but I\u2019m going to cut to the chase regarding how it affects types first.<\/p>\n<p>Take this example that initially just confused me:<\/p>\n<pre class=\"brush:php\">def do_it({:starsky, do_what}), do: do_what\r\ndef do_it({:hutch, do_what}), do: do_what<\/pre>\n<p>This is a very simple and contrived example illustrating a tuple being used to define a function. Elixir uses pattern matching when the function is called, so if I call the function like so:<\/p>\n<pre class=\"brush:php\">do_it({:hutch, \"Something cool needs to be done here\"})<\/pre>\n<p>The result is that it will call the second function because it will match on <code>:hutch<\/code>. My first thought in looking at that was simply, \u201cWhy not just create a <code>:hutch<\/code> type? Why not a separate hutch function?\u201d<\/p>\n<p>There are also <a href=\"https:\/\/hexdocs.pm\/elixir\/master\/guards.html\">guard clauses<\/a> that can check the types at runtime, like so:<\/p>\n<pre class=\"brush:php\">def do_it({:starsky, do_what}) when is_binary(do_what), do: do_what<\/pre>\n<p>As a follow-up to that, why can\u2019t we define types in a JSON API? We <em>can<\/em> define a type on either end, but everything is just going to be serialized to a string, sent over the wire, and then deserialized on the other end back into whatever type you\u2019ve defined.<\/p>\n<p>That\u2019s an important detail when you consider that Elixir works using message passing. Elixir functions are set up so that they can transparently be called across processes, heaps, or even machines in a cluster. You might say you\u2019re sending some fancy, contrived type that you\u2019ve created, but underneath it all it\u2019s just a collection of basic data types with a name attached to it.<\/p>\n<p>That\u2019s all those tuples are in this example. Here is my <code>:starsky<\/code> payload, and here is my <code>:hutch<\/code> payload. As long as the rest of the structure matches the pattern of what\u2019s being passed in, it will call the appropriate function. If the structure doesn\u2019t match, the call will fail.<\/p>\n<p>Because distributed computing transparently across nodes outside of a single heap space is critical to the functionality of Elixir, any more elaborate approach than this would involve serializing, passing, and deserializing for every function call before we even get into contract management.<\/p>\n<p>Message passing is at the root of everything in Elixir, and it\u2019s critical to operating millions of isolated heaps across multiple machines. Those isolated heap spaces make extreme fault-tolerance possible since they can be killed and restarted without impacting other parts of the system.<\/p>\n<p>These are our building blocks.<\/p>\n<h2>Strong, Dynamic, Gradual Typing<\/h2>\n<p>Wait\u2026what?<\/p>\n<p>That was my reaction until I attended Jason Voegele\u2019s excellent <a href=\"https:\/\/www.youtube.com\/watch?v=JT0ECYZ9FaQ\">Optimistic Type Checking<\/a> talk at ElixirConf this past September. If you have the time, it\u2019s worth a watch, but I\u2019m going to summarize with some of his excellent examples.<\/p>\n<p>The example in the previous section looked like dynamic typing because we weren\u2019t doing anything with it. Elixir does actually have strict type checking between primitives.<\/p>\n<pre class=\"brush:php\">my_string = \"Bob\"\r\nmy_int = 5\r\nmy_string + my_int # This is an error<\/pre>\n<p>In other languages, you might use a <code>+<\/code> for concatenation of strings or addition. In Elixir, there is no operator overloading. You\u2019ll see a <a href=\"http:\/\/elixir-lang.org\/getting-started\/basic-operators.html\">whole set of operators<\/a> that exist for different types.<\/p>\n<pre class=\"brush:php\">1 + 1 # = 2 Math\r\n[1,2,3] ++ [4,5,6] # = [1,2,3,4,5,6] List concatenation\r\n\"foo\" &lt;&gt; \"bar\" # = \"foobar\" String concatenation<\/pre>\n<p>The <a href=\"http:\/\/erlang.org\/doc\/man\/dialyzer.html\">Dialyzer<\/a> takes advantage of this by scanning your code and inferring types based on the operators used with them. Variables next to a plus can only be numbers, and so on. With this knowledge, Dialyzer can look through your code and identify instances where a variable is being passed a type that doesn\u2019t belong. Dialyzer works on compiled BEAM files and ships with Erlang, but it can be easily plugged into your Elixir project with <a href=\"https:\/\/github.com\/jeremyjh\/dialyxir\">Dialyxir<\/a> or <a href=\"https:\/\/github.com\/fishcakez\/dialyze\">Dialyze<\/a>.<\/p>\n<p>The combination of pattern matching and Dialyzer will catch most of your type violations. You get strong typing and compile time type checking, which strikes a nice balance between the flexibility of dynamic types as well as the strictness of static types.<\/p>\n<p>You may want more than those; implicit checks aren\u2019t always enough, and that\u2019s where <a href=\"http:\/\/elixir-lang.org\/getting-started\/typespecs-and-behaviours.html\">typespecs<\/a> come in handy. Sometimes it\u2019s possible to create open-ended type definitions, and I\u2019ll use Voegele\u2019s example to demonstrate that here.<\/p>\n<pre class=\"brush:php\">def add(x, y), do: x + y\r\n  # add(number, number) :: number\r\n\r\ndef divide(x, y), do: x \/ y\r\n  # divide(number, number) :: float\r\n\r\ndef and(false, _), do: false\r\ndef and(_, false), do: false\r\ndef and(true, true), do: true\r\n  # and(any, any) :: boolean<\/pre>\n<p>When declaring a pattern for a function with an unused variable, you leave the pattern open-ended. In these cases, you can define a typespec to explicitly declare the definition.<\/p>\n<pre class=\"brush:php\">@spec and(boolean, boolean) :: boolean\r\ndef and(false, _), do: false\r\ndef and(_, false), do: false\r\ndef and(true, true), do: true<\/pre>\n<p>By adding that spec declaration, Dialyzer can now check every place in the code that the <code>and\/2<\/code> function is called to ensure that Booleans are being passed for both arguments and that what\u2019s being returned is also a Boolean. This job is made a lot easier because of immutable data; it doesn\u2019t have to worry that a string it checked will be reassigned an integer later on.<\/p>\n<p>Typespecs work with all of the basic types: primitives, atoms, lists, maps, tuples, and even <a href=\"http:\/\/elixir-lang.org\/getting-started\/typespecs-and-behaviours.html#defining-custom-types\">custom types<\/a>.<\/p>\n<h3>This is gradual typing<\/h3>\n<p>The end result here is that you get dynamic typing with implicit compile time type-checking by default. You can utilize runtime enforcement with guards, and you can explicitly check any questionable types with typespecs.<\/p>\n<p>Immutable data makes verifying these easier while the adherence to message-passing-compatible structure makes distributed computing and transparent clustering possible. In other words, you gradually increase your type strictness in the same way that you gradually iterate on your development approach.<\/p>\n<p>This approach is an excellent compromise that gives you the best of both worlds with dynamic and static typing, while avoiding the drawbacks of each.<\/p>\n<h2>Efficient Usage<\/h2>\n<p>Earlier in this post, I showed the string concatenation operator for sake of example, but that\u2019s not very efficient.<\/p>\n<p>Raw string concatenation results in creating a new string from two other strings. This is inefficient because now our memory usage is the combination of both prior strings and the result. Erlang\u2019s secret weapon is to instead use IO Lists to pass and render arrays of string parts rather than combining them in memory.<\/p>\n<p>If you want to go deep on this subject, the folks over at Big Nerd Ranch did a two-part blog post exploring the <a href=\"https:\/\/www.bignerdranch.com\/blog\/elixir-and-io-lists-part-1-building-output-efficiently\/\">concept of IO.List<\/a>, as well as the implementation used within the <a href=\"https:\/\/www.bignerdranch.com\/blog\/elixir-and-io-lists-part-2-io-lists-in-phoenix\/\">Phoenix view layer<\/a> that makes its microsecond response times possible.<\/p>\n<p>Those posts go into more detail and numbers than I will here, but picture this. You create a multilevel template within Phoenix. You\u2019ve got a layout, views, and smaller pieces, but intermixed with all of your code and variables are bits of HTML.<\/p>\n<p>When Phoenix is compiled, those bits are separated into immutable pieces of memory\u2026once. Rendering a view and passing it back through to the requestor no longer becomes a task of outputting all of the combined HTML intermixed with the data. Instead this returns an array of memory references to pieces of HTML alongside the data that will fill those gaps.<\/p>\n<p>When that array gets back to the socket, each piece is sent directly to the socket in proper order\u2026byte by byte\u2026without using any more RAM than it did after compilation. Iterating through a list surrounded by <code>\"&lt;li&gt;\"<\/code> and <code>\"&lt;\/li&gt;\"<\/code>? Each of those parts is a single memory reference no matter how many list items you combine.<\/p>\n<p>On the one hand, I felt a responsibility to include that; running off and doing string concats and explaining how the Dialyzer does it is great even though that particular case isn\u2019t efficient. On the other hand, knowing where that blazing Phoenix speed comes from is pretty cool\u2026and knowing is half the battle.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"https:\/\/blog.codeship.com\/understanding-elixir-types\/\">Understanding Elixir Types<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\">WCG partner<\/a> Florian Motlik at the <a href=\"http:\/\/blog.codeship.com\/\">Codeship Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up the way it was or what benefits come from it. Hopefully, I can get you through some of my initial confusion about Elixir types. The &hellip;<\/p>\n","protected":false},"author":81,"featured_media":4128,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[309],"class_list":["post-16344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby","tag-elixir"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Understanding Elixir Types - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Elixir Types - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/flomotlik\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-06T10:15:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Florian Motlik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/flomotlik\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Florian Motlik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\"},\"author\":{\"name\":\"Florian Motlik\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2ce85ee77a6cb5f80143c1f88bb8d10\"},\"headline\":\"Understanding Elixir Types\",\"datePublished\":\"2017-03-06T10:15:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\"},\"wordCount\":1331,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg\",\"keywords\":[\"Elixir\"],\"articleSection\":[\"Ruby\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\",\"name\":\"Understanding Elixir Types - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg\",\"datePublished\":\"2017-03-06T10:15:37+00:00\",\"description\":\"When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ruby\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/ruby\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Understanding Elixir Types\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2ce85ee77a6cb5f80143c1f88bb8d10\",\"name\":\"Florian Motlik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d325d3a5660b2d2b2b433ebbe06cac2210d8d0e5083c7998b4ca07cc24d7cf3e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d325d3a5660b2d2b2b433ebbe06cac2210d8d0e5083c7998b4ca07cc24d7cf3e?s=96&d=mm&r=g\",\"caption\":\"Florian Motlik\"},\"sameAs\":[\"http:\/\/blog.codeship.com\/\",\"https:\/\/www.facebook.com\/flomotlik\",\"http:\/\/at.linkedin.com\/in\/florianmotlik\",\"https:\/\/x.com\/http:\/\/twitter.com\/flomotlik\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/florian-motlik\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding Elixir Types - Web Code Geeks - 2026","description":"When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/","og_locale":"en_US","og_type":"article","og_title":"Understanding Elixir Types - Web Code Geeks - 2026","og_description":"When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up","og_url":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/flomotlik","article_published_time":"2017-03-06T10:15:37+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg","type":"image\/jpeg"}],"author":"Florian Motlik","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/flomotlik","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Florian Motlik","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/"},"author":{"name":"Florian Motlik","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2ce85ee77a6cb5f80143c1f88bb8d10"},"headline":"Understanding Elixir Types","datePublished":"2017-03-06T10:15:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/"},"wordCount":1331,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg","keywords":["Elixir"],"articleSection":["Ruby"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/","url":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/","name":"Understanding Elixir Types - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg","datePublished":"2017-03-06T10:15:37+00:00","description":"When I first started getting into Elixir, one thing that never quite made sense to me was the type system. It worked\u2026but it wasn\u2019t clear why it was set up","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/ruby-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/ruby\/understanding-elixir-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Ruby","item":"https:\/\/www.webcodegeeks.com\/category\/ruby\/"},{"@type":"ListItem","position":3,"name":"Understanding Elixir Types"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2ce85ee77a6cb5f80143c1f88bb8d10","name":"Florian Motlik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d325d3a5660b2d2b2b433ebbe06cac2210d8d0e5083c7998b4ca07cc24d7cf3e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d325d3a5660b2d2b2b433ebbe06cac2210d8d0e5083c7998b4ca07cc24d7cf3e?s=96&d=mm&r=g","caption":"Florian Motlik"},"sameAs":["http:\/\/blog.codeship.com\/","https:\/\/www.facebook.com\/flomotlik","http:\/\/at.linkedin.com\/in\/florianmotlik","https:\/\/x.com\/http:\/\/twitter.com\/flomotlik"],"url":"https:\/\/www.webcodegeeks.com\/author\/florian-motlik\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=16344"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16344\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/4128"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=16344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=16344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=16344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}