<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="66112" data-post-id="66112">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="crabonature" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/120/7311_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  crabonature
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="merlin" data-post="32" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/m/8baadc/48.png" class="avatar"> merlin:</div>
<blockquote>
<p>What if you had 40 000 functions ?</p>
</blockquote>
</aside>
<p>Oo 40 000 functions just in one module or written at once or by one day by one programmer? Seriously or are you joking? Quite really really bad design. Don’t forget about 40 000 <a class="mention" href="/u/doc" rel="nofollow">@doc</a> blocks. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="merlin" data-post="32" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/m/8baadc/48.png" class="avatar"> merlin:</div>
<blockquote>
<p>If you think that this:</p>
<p><a class="mention" href="/u/spec" rel="nofollow">@spec</a> some_function(SomeType.t()) :: SomeOtherType.t()<br>
def some_function(some_arg)</p>
<p>is easier to read, more concise and less error-prone  than:</p>
<p>def some_function(some_arg :: SomeType.t()) :: SomeOtherType.t() do<br>
end</p>
<p>So be it. Let’s agree to disagree.</p>
</blockquote>
</aside>
<p>Yep first example is less error prone, because you have to think twice about the same problem. Firstly you think about types and what function will have to produce, and secondly you just think up names for entities. All is true only if you write <code>@spec</code> before your function. If you write specs for written functions earlier it got less sesne just like writing simple unit tests after implementation. Always is better to think twice about a problem than once. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>Side note:</p>
<p>Haskell is statically typed language untill compilation and got wonderfull types definitions, and they are just like annotations.</p>
<pre data-code-wrap="haskell"><code class="lang-haskell">sayMe :: (Integral a) =&gt; a -&gt; String  
sayMe 1 = "One!"  
sayMe 2 = "Two!"  
sayMe 3 = "Three!"  
</code></pre>
<p>One more example from Elixir:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def some_function(%Some{p: pattern_match_here_blah, blah: blah} = arg1 :: integer(),
                  :match = match :: atom(),
                  arg3 :: integer()) :: integer()
do
  # something
end
</code></pre>
<p>vs.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec some_function(integer(), atom(), integer()) :: integer()
def some_function(%Some{p: pattern_match_here_blah, blah: blah} = arg1,
                  :match = match,
                  arg3)
do
  # something
end 
</code></pre>
<p>Which one give you more information when you first look at it?</p>
<p>Second example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec funnier(integer()) :: integer()
def funnier(0), do: 1
def funnier(1), do: 0
def funnier(n), do: funnier(n-1)

So with types in function head you would like to put them where?

# define special clause for types? - it's just spec without @spec polluted by arg names :)
def funnier(n :: integer()) :: integer()

def funnier(0 :: integer()) :: integer(), do: 1  #or just here?
def funnier(1 :: integer()) :: integer(), do: 0  #or maybe here?
def funnier(n :: integer()) :: integer(), do: funnier(n-1) #or here??
# or everywhere???
</code></pre>
<p>So?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66112" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-66112" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66112"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #32"></div>
  </section>
</div>
    <div class="postbit" id="66125" data-post-id="66125">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="peerreynders" data-post="31" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>I used to feel the same way until I realized that declaring names and types in the same definition forced multi-line signatures much faster. Some might argue that keeping names and types separate is actually more concise - similar to how header and row information in a table interact, The spec focuses on typing while the function header focuses on naming - sacrificing easy parameter name/type correlation for focus.</p>
</blockquote>
</aside>
<p>Well take OCaml, you ‘type’ things like:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let blah (a:float) (b:string) = (string_of_float a) ^ b
</code></pre>
<p>But doing that is entirely useless as it is trivially inferred, so you can just do:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let blah a b = (string_of_float a) ^ b
</code></pre>
<p>You really only need to specify a type if something is ambiguous (almost never) or you are purposefully restricting it.  This is how adding types should be done.  (In addition the IDE will show the type of anything, including functions when I hover over or put my cursor in it.  ^.^)</p>
<aside class="quote no-group quote-modified" data-username="crabonature" data-post="33" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>Haskell is statically typed language untill compilation and got wonderfull types definitions, and they are just like annotations.</p>
<p>sayMe :: (Integral a) =&gt; a -&gt; String<br>
sayMe 1 = “One!”<br>
sayMe 2 = “Two!”<br>
sayMe 3 = “Three!”</p>
</blockquote>
</aside>
<p>Or in OCaml:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let sayMe = function
| 1 -&gt; "One!"
| 2 -&gt; "Two!"
| 3 -&gt; "Three!"
(* Along with a warning for missing possible inputs, you'll get an exception then *)
</code></pre>
<p>^.^</p>
<aside class="quote no-group" data-username="crabonature" data-post="33" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>One more example from Elixir:</p>
</blockquote>
</aside>
<p>Verses having good type inference.  <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<p>For note, in OCaml you can specify types inline, as I showed above, but you can also put them in an <code>mli</code> file, which is the ‘public interface’ file, thus keeping your main file clean.</p>
<aside class="quote no-group" data-username="crabonature" data-post="33" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>So with types in function head you would like to put them where?</p>
</blockquote>
</aside>
<p>Well with things like <code>0</code> and <code>1</code> the type is already there as part of the constant value, so adding extra types seems useless, like doing <code>(6.28 : float)</code> in OCaml is entirely useless.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66125" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-66125" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66125"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #33"></div>
  </section>
</div>
    <div class="postbit" id="66138" data-post-id="66138">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="peerreynders" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/120/5826_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  peerreynders
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="34" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Well take OCaml, you ‘type’ things like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">let blah (a:float) (b:string) = (string_of_float a) ^ b
</code></pre>
<p>But doing that is entirely useless as it is trivially inferred, so you can just do:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">let blah a b = (string_of_float a) ^ b
</code></pre>
</blockquote>
</aside>
<p>I’d go with:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">let blah : float -&gt; string -&gt; string = 
  fun a b -&gt; (string_of_float a) ^ b
</code></pre>
<p>and of course in the <code>mli</code></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">val blah : float -&gt; string -&gt; string
</code></pre>
<blockquote>
<p>You really only need to specify a type if something is ambiguous (almost never) or you are purposefully restricting it. This is how adding types should be done. (In addition the IDE will show the type of anything, including functions when I hover over or put my cursor in it. ^.^)</p>
</blockquote>
<p>I’ve always felt that type inference is a double edged sword. Its convenience is indisputable but unfortunately it also lets you sometimes progress so far into the weeds that by the time it complains you have no idea where all these conflicting types are coming from or what they mean. Explicitly specifying the intended types acts like progressive checkpoints:</p>
<ul>
<li>If you can’t <em>specify</em> the type, you probably don’t know what you are doing anyway - so timeout and figure out what you are doing.</li>
<li>Type inference can then catch divergence between the <em>intended</em> and the <em>actual</em> type at the <strong>earliest possible moment</strong> - in Elm I liked the fact that missing type declarations were warnings that could be elevated to errors.</li>
</ul>
<p>Apart from the fact that I don’t like to have to rely on the <em>presence</em> of an IDE to tell me something what should be in plain sight.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66138" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-66138" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66138"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #34"></div>
  </section>
</div>
    <div class="postbit" id="66141" data-post-id="66141">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="crabonature" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/120/7311_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  crabonature
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Haskell will infere types properly too just like in Ocaml. All helps you in finding some potential places of code bugs, no more.</p>
<p>But you know that writing some types in functional language or other languages helps in readibility and understability of code (just like with documenting your code), no matter that compiler, dialyzer can infere it?</p>
<p>Programmer is not a compiler or „inferer”, with some type hints it’s just simpler to understand code no need to prove that this thing quack like a duck so it could be a duck.</p>
<p>There is some rule in programming that you write code once  but there will be a need to read it n times in future by many people.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66141" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-66141" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66141"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #35"></div>
  </section>
</div>
    <div class="postbit" id="66149" data-post-id="66149">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="gon782" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  gon782
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="crabonature" data-post="36" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>But you know that writing some types in functional language or other languages helps in readibility and understability of code (just like with documenting your code), no matter that compiler, dialyzer can infere it?</p>
<p>Programmer is not a compiler or „inferer”, with some type hints it’s just simpler to understand code no need to prove that this thing quack like a duck so it could be a duck.</p>
</blockquote>
</aside>
<p>To be fair, OCaml has great support for editors in <code>merlin</code> which you can use to get type information. Being that OCaml as a language has made a lot of choices that make it much easier to infer types without issues (ambiguity is much rarer than in Haskell) it actually does fine without type annotations as long as people are using the common tools. I can’t imagine why people wouldn’t, either, because OCaml tooling is one of the easiest to set up in my experience.</p>
<p>With that said, I think it’s useful to document your work (as I’m sure most people agree with). It’s just that when you’re exploring it’s not as necessary to do that in OCaml, where as in Haskell you can quite quickly end up with the compiler not being able to infer your types.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66149" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-66149" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66149"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #36"></div>
  </section>
</div>
    <div class="postbit" id="66176" data-post-id="66176">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="peerreynders" data-post="35" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>I’d go with:</p>
</blockquote>
</aside>
<p>Yep you are typing the <code>blah</code> instead of the arguments there, perfectly reasonable, but it means you have to <em>fully</em> define the type instead of just a single specific bit.  ^.^</p>
<aside class="quote no-group" data-username="peerreynders" data-post="35" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>I’ve always felt that type inference is a double edged sword. Its convenience is indisputable but unfortunately it also lets you sometimes progress so far into the weeds that by the time it complains you have no idea where all these conflicting types are coming from or what they mean.</p>
</blockquote>
</aside>
<p>Not really with OCaml, everything is inferenced within a single function, not out, unlike Haskell and it’s HKT’s that require whole program inference, which can create truly gnarly errors.</p>
<aside class="quote no-group" data-username="peerreynders" data-post="35" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>Type inference can then catch divergence between the intended and the actual type at the earliest possible moment - in Elm I liked the fact that missing type declarations were warnings that could be elevated to errors.</p>
</blockquote>
</aside>
<p>And in OCaml the compiler can generate the <code>mli</code> files for you.  ^.^</p>
<aside class="quote no-group" data-username="peerreynders" data-post="35" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>Apart from the fact that I don’t like to have to rely on the presence of an IDE to tell me something what should be in plain sight.</p>
</blockquote>
</aside>
<p>Except they aren’t.  If you see the function then you can see how arguments are used, thus you already know from that.  If you are looking at a callsite of a function, then well it cannot tell you in source, so an IDE is awesome there.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="crabonature" data-post="36" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>Haskell will infere types properly too just like in Ocaml. All helps you in finding some potential places of code bugs, no more.</p>
</blockquote>
</aside>
<p>Not entirely.  Haskell is an HKT language rather than pure ML, thus meaning that you absolute <em>have</em> to put types in many locations that you otherwise would not need to in an ML language.</p>
<aside class="quote no-group" data-username="crabonature" data-post="36" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>But you know that writing some types in functional language or other languages helps in readibility and understability of code (just like with documenting your code), no matter that compiler, dialyzer can infere it?</p>
</blockquote>
</aside>
<p>Hear hear, but I do prefer the generated <code>mli</code> files (that I can then prune to shrink the public interface).</p>
<aside class="quote no-group" data-username="crabonature" data-post="36" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crabonature/48/7311_2.png" class="avatar"> crabonature:</div>
<blockquote>
<p>There is some rule in programming that you write code once  but there will be a need to read it n times in future by many people.</p>
</blockquote>
</aside>
<p>Which is a big reason I prefer strong static types!  ^.^</p>
<aside class="quote no-group" data-username="gon782" data-post="37" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/eada6e/48.png" class="avatar"> gon782:</div>
<blockquote>
<p>To be fair, OCaml has great support for editors in merlin which you can use to get type information. Being that OCaml as a language has made a lot of choices that make it much easier to infer types without issues (ambiguity is much rarer than in Haskell) it actually does fine without type annotations as long as people are using the common tools. I can’t imagine why people wouldn’t, either, because OCaml tooling is one of the easiest to set up in my experience.</p>
</blockquote>
</aside>
<p>This right here.</p>
<aside class="quote no-group" data-username="gon782" data-post="37" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/eada6e/48.png" class="avatar"> gon782:</div>
<blockquote>
<p>With that said, I think it’s useful to document your work (as I’m sure most people agree with). It’s just that when you’re exploring it’s not as necessary to do that in OCaml, where as in Haskell you can quite quickly end up with the compiler not being able to infer your types.</p>
</blockquote>
</aside>
<p>That is because of its HKT typing system.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66176" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-66176" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66176"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #37"></div>
  </section>
</div>
    <div class="postbit" id="66183" data-post-id="66183">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="andre1sk" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/andre1sk/120/1380_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  andre1sk
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think some degree of automation with generating specs could go a long way. If language server provided it’s best guess to the IDE that could serve as a a decent starting point</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66183" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-66183" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66183"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #38"></div>
  </section>
</div>
    <div class="postbit" id="66207" data-post-id="66207">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dogweather" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dogweather/120/1906_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dogweather
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>To some extent, the syntax is overpowering. In your simple example, it looks like syntactic sugar could solve it: E.g., we’d write specs like Swift syntax, which would be translated into <a class="mention" href="/u/spec" rel="nofollow">@spec</a> at a lower level:</p>
<pre><code>def squareRoot(i: Float) -&gt; Float do
  ...
end
</code></pre>
<p>Far less noisy and could translate 1:1 into Elixr/<a class="mention" href="/u/spec" rel="nofollow">@spec</a> syntax. Just a pre-processor would be necessary to work with the current tooling.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66207" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-66207" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66207"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #39"></div>
  </section>
</div>
    <div class="postbit" id="66259" data-post-id="66259">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="gon782" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  gon782
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="dogweather" data-post="40" data-topic="11665">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dogweather/48/1906_2.png" class="avatar"> dogweather:</div>
<blockquote>
<p>def squareRoot(i: Float) -&gt; Float do<br>
…<br>
end</p>
</blockquote>
</aside>
<p>Don’t you think you’d need a parsing change to be made in order for this to work, though? When considering something like that, it might be an idea to move to an entirely new parser/language that doesn’t require as much ceremony at all to define a function.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66259" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-66259" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66259"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #40"></div>
  </section>
</div>
    <div class="postbit" id="66339" data-post-id="66339">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>actually you could represent that with a minor edit in the Elixir AST.  Look at what I did with TypedElixir and MLElixir.  ^.^</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="66339" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/does-anybody-else-feel-this-way-about-spec-visually-overpowering/11665/42">Post #41</a>
	                </div>
	            </div>
              <div id="likers-container-66339" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="66339"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #41"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/11665/load_more?page=5">Load more posts (12 remaining)</a>
</div></template></turbo-stream>