Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>run is of type String -> String, so you probably don't want the do notation[1]. I'd advise you to do this:</p> <ol> <li>comment out everything below the listDouble function, load that, and be sure that'll compile. </li> <li><p>add a test value that's formatted like the file you expect. Something like:</p> <pre><code> t = "[1,9]\n3\n1.0 1.0 1.0\n1.0 1.0 1.0\n1.0\n1.0" </code></pre></li> <li><p>add a test values that the top level for the values you're defining in run</p> <pre><code>ln = lines t seq = ln!!0 states = ln!!1 l1 = listDouble (ln!!2) l2 = listDouble (ln!!3) tr1 = readDouble (ln!!4) tr2 = readDouble (ln!!5) </code></pre></li> <li><p>use the type signature of scoreFunction to guide you in building the arguments to that function, then the rest of run, and finally main.</p></li> </ol> <p>Learn to use an interpreter, such as Hugs, ghci. Learn the :r and :t commands. For example (i'm using currying to give some but not all of a functions arguments): </p> <pre><code> :t scoreFunction :t scoreFunction "" :t scoreFunction 3445 </code></pre> <p>You can use this to have the system help you determine if you're on the right track. Doing this at the top level with introduce a conflict with a Prelude.seq function - either rename your seq, or refernence yours as Main.seq.</p> <p>Haskell is notorious for error messages that are inscrutable to beginners, so I'd recommend periodically rolling back to a version that compiles, either by commenting out your current experiments (which is what I had you do in step 1 above), or using your editors undo function.</p> <p>[1]I say probably because Strings, being lists of Characters, are instances of the Monad class, but that's fairly advanced </p>
 

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