POV-Ray : Newsgroups : povray.off-topic : My hypothesis : Re: My hypothesis Server Time
29 Jul 2024 14:22:37 EDT (-0400)
  Re: My hypothesis  
From: Invisible
Date: 5 Sep 2011 04:52:52
Message: <4e648de4@news.povray.org>
On 02/09/2011 04:36 PM, Invisible wrote:

> Hypothesis: The Haskell language isn't hard. Typical Haskell *programs*
> are hard.

Let's test that hypothesis. Consider the following example:

   module Main where

   import System.IO
   import System.Random

   main = do
     x <- randomRIO (1, 100)
     main_loop x

   main_loop x = do
     putStr "Guess: "
     hFlush stdout
     l <- getLine
     let g = read l
     if g == x
       then putStrLn "Correct."
       else do
         if g < x
           then putStrLn "Too low."
           else putStrLn "Too high."
         main_loop x

This is written in Haskell. However, I would expect that anybody 
familiar with computer programming should be able to figure out what 
this does, without knowing anything at all about Haskell. I mean, you 
couldn't /write/ this code, but you can /read/ it and figure out what it 
does. Which would seem to strongly contradict "Haskell is incomprehensible".

...or maybe I'm just delusional from having spent too long with Haskell? 
Maybe it only looks readable to my eyes. What do we say, people?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.