<div dir="ltr">Sorry about the last post -- I accidentally clicked "send" before I'd written my message.<br><br>Sok Ha:<br><br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">expr    = show send ++ "+" ++ show more ++ "=" show money</blockquote>
<div><br></div><div>should read</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><span style="font-family:arial,sans-serif;font-size:13px">expr    = show send ++ "+" ++ show more ++ "=" ++ show money</span></div>
<div><br></div></blockquote>The error message is rather cryptic -- ghc seems to assume that "=" must be intended as a function, since it it has other values (potential arguments) to the right of it. I usually don't spend much time trying to figure out ghc error messages unless I really can't solve the problem by just looking over the offending line carefully. Very often it's just a typo (as it seems to be in your case).</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 26, 2014 at 7:24 PM, Matthew Moppett <span dir="ltr"><<a href="mailto:matthewmoppett@gmail.com" target="_blank">matthewmoppett@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sok Ha.<br>
<div class="im HOEnZb"><br>
expr    = show send ++ "+" ++ show more ++ "=" show money<br>
<br>
<br>
<br>
</div><div class="HOEnZb"><div class="h5">On Sun, Jan 26, 2014 at 7:16 PM, Sok Ha Chang <<a href="mailto:shaegis@gmail.com">shaegis@gmail.com</a>> wrote:<br>
> Hi.<br>
> I’m new to Haskell.<br>
> Use Haskell Platform on MacBook Air.<br>
> $ ghc --version<br>
> The Glorious Glasgow Haskell Compilation System, version 7.6.3<br>
><br>
> I’m try to solve alphametic.<br>
> SEND + MORE = MONEY<br>
><br>
> Here is code…<br>
> ----------------------------------------------------------------------------------------------------------<br>
> import Data.List<br>
><br>
> decryp :: [Int] -> String -> String<br>
> decryp (s:e:n:d:o:r:y:[]) a =<br>
>         if send + more == money then expr:a else a<br>
>         where<br>
>                 send    = s * 1000 + e * 100 + n * 10 + d<br>
>                 more    = 1000 + o * 100 + r * 10 + e<br>
>                 money   = 10000 + o * 1000 + n * 100 + e * 10 + y<br>
>                 expr    = show send ++ "+" ++ show more ++ "=" show money<br>
><br>
> decrypSolver :: [String]<br>
> decrypSolver =<br>
>         foldr decryp [] (permutations 7 [0, 2, 3, 4, 5, 6, 7, 8, 9])<br>
> ----------------------------------------------------------------------------------------------------------<br>
><br>
> Error Messages is<br>
> ./decrypSolver.hs: line 10, column 60:<br>
>   Couldn't match expected type `(a0 -> String) -> Int -> [Char]'<br>
>               with actual type `[Char]'<br>
>   The function `"="' is applied to two arguments,<br>
>   but its type `[Char]' has none<br>
>   In the second argument of `(++)', namely `"=" show money'<br>
>   In the second argument of `(++)', namely<br>
>     `show more ++ "=" show money’<br>
> ----------------------------------------------------------------------------------------------------------<br>
><br>
> How can I fix this?<br>
><br>
> Thank you.<br>
><br>
> Sincerely, S. Chang<br>
> _______________________________________________<br>
> Beginners mailing list<br>
> <a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>