Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's hard to see exactly what you want here. It is possible to make your code parse with only indentation changes:</p> <pre><code>import Data.ByteString as B import Data.ByteString.Internal as I import Data.Bits main = do input &lt;- getLine let bs = B.pack input let intermediatebs = unfoldrN ((B.length bs)*2) unfld 0 where unfld i | Prelude.rem i 2 == 0 = Just (top4 $ B.index bs (i/2) , i+1) | otherwise = Just (bottom4 $ B.index bs (i/2) , i+1) top4bits x = shiftR x 4 bottom4bits x = x .&amp;. 0x0F top4 x = convertASCIIword8 $ top4bits x bottom4 x = convertASCIIword8 $ bottom4bits x convertASCIIword8 x | x &lt;= 9 = I.c2w '0' + x | otherwise = I.c2w 'A' + (x-10) let outputbs = B.map I.w2c $ intermediatebs putStrLn (outputbs) </code></pre> <p>although it won't compile due to ambiguous <code>getLine</code> and <code>putStrLn</code> occurrences. You may want to <code>import qualified</code> where appropriate. Key observations:</p> <ul> <li><p>Do-blocks, let-blocks etc. start from the left edge of <em>the first thing inside</em> them, regardless of where the keyword is itself. E.g.</p> <pre><code>do x y -- ^ because of where the x is, all future lines have to line up with it let x = ... y = ... -- ^ if you have code appearing left of here, the let-block ends </code></pre> <p>As a consequence, I often give <code>do</code> and <code>where</code> their own line before starting a block. In the example I gave above, you can see that even if I moved the do-block into a function with a longer or shorter name, the indentation wouldn't change.</p></li> <li><p>Lines in the same block that start indented are a continuation of the previous line. Guards are a continuation so need to be indented, likewise <code>where</code> for a let assignment needs to be indented further than the assignment itself.</p></li> <li>The <code>in do</code> at the end of your block was redundant, so I removed it (alternatively, just indenting it would have worked too).</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload