Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Error Message when trying to solve       alphametic(SEND + MORE =
      MONEY) (Sok Ha Chang)
   2. Re:  Error Message when trying to solve alphametic(SEND +
      MORE = MONEY) (Matthew Moppett)
   3. Re:  Error Message when trying to solve alphametic(SEND +
      MORE = MONEY) (Matthew Moppett)
   4. Re:  Error Message when trying to solve   alphametic(SEND +
      MORE = MONEY) (Sok Ha Chang)
   5. Re:  Error Message when trying to solve   alphametic(SEND +
      MORE = MONEY) (Sok Ha Chang)


----------------------------------------------------------------------

Message: 1
Date: Sun, 26 Jan 2014 21:16:15 +0900
From: Sok Ha Chang <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Error Message when trying to solve
        alphametic(SEND + MORE = MONEY)
Message-ID: <[email protected]>
Content-Type: text/plain; charset=euc-kr

Hi.
I?m new to Haskell.
Use Haskell Platform on MacBook Air.
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3

I?m try to solve alphametic.
SEND + MORE = MONEY

Here is code?
----------------------------------------------------------------------------------------------------------
import Data.List

decryp :: [Int] -> String -> String
decryp (s:e:n:d:o:r:y:[]) a =
        if send + more == money then expr:a else a
        where   
                send    = s * 1000 + e * 100 + n * 10 + d
                more    = 1000 + o * 100 + r * 10 + e
                money   = 10000 + o * 1000 + n * 100 + e * 10 + y
                expr    = show send ++ "+" ++ show more ++ "=" show money

decrypSolver :: [String]
decrypSolver =
        foldr decryp [] (permutations 7 [0, 2, 3, 4, 5, 6, 7, 8, 9])
----------------------------------------------------------------------------------------------------------

Error Messages is
./decrypSolver.hs: line 10, column 60:
  Couldn't match expected type `(a0 -> String) -> Int -> [Char]'
              with actual type `[Char]'
  The function `"="' is applied to two arguments,
  but its type `[Char]' has none
  In the second argument of `(++)', namely `"=" show money'
  In the second argument of `(++)', namely
    `show more ++ "=" show money?
----------------------------------------------------------------------------------------------------------

How can I fix this?

Thank you.

Sincerely, S. Chang

------------------------------

Message: 2
Date: Sun, 26 Jan 2014 19:24:00 +0700
From: Matthew Moppett <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Error Message when trying to solve
        alphametic(SEND + MORE = MONEY)
Message-ID:
        <camlejzbxchjekkyhvqnjdyqb3u9t-xw6td4frl4fwx5yv5f...@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

Hi Sok Ha.

expr    = show send ++ "+" ++ show more ++ "=" show money



On Sun, Jan 26, 2014 at 7:16 PM, Sok Ha Chang <[email protected]> wrote:
> Hi.
> I?m new to Haskell.
> Use Haskell Platform on MacBook Air.
> $ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 7.6.3
>
> I?m try to solve alphametic.
> SEND + MORE = MONEY
>
> Here is code?
> ----------------------------------------------------------------------------------------------------------
> import Data.List
>
> decryp :: [Int] -> String -> String
> decryp (s:e:n:d:o:r:y:[]) a =
>         if send + more == money then expr:a else a
>         where
>                 send    = s * 1000 + e * 100 + n * 10 + d
>                 more    = 1000 + o * 100 + r * 10 + e
>                 money   = 10000 + o * 1000 + n * 100 + e * 10 + y
>                 expr    = show send ++ "+" ++ show more ++ "=" show money
>
> decrypSolver :: [String]
> decrypSolver =
>         foldr decryp [] (permutations 7 [0, 2, 3, 4, 5, 6, 7, 8, 9])
> ----------------------------------------------------------------------------------------------------------
>
> Error Messages is
> ./decrypSolver.hs: line 10, column 60:
>   Couldn't match expected type `(a0 -> String) -> Int -> [Char]'
>               with actual type `[Char]'
>   The function `"="' is applied to two arguments,
>   but its type `[Char]' has none
>   In the second argument of `(++)', namely `"=" show money'
>   In the second argument of `(++)', namely
>     `show more ++ "=" show money?
> ----------------------------------------------------------------------------------------------------------
>
> How can I fix this?
>
> Thank you.
>
> Sincerely, S. Chang
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

Message: 3
Date: Sun, 26 Jan 2014 19:31:19 +0700
From: Matthew Moppett <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Error Message when trying to solve
        alphametic(SEND + MORE = MONEY)
Message-ID:
        <camlejzctupw7ycintvb+wgthvkdyh+gv+zyyfhd394y9bfo...@mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"

Sorry about the last post -- I accidentally clicked "send" before I'd
written my message.

Sok Ha:

expr    = show send ++ "+" ++ show more ++ "=" show money


should read

expr    = show send ++ "+" ++ show more ++ "=" ++ show money

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).


On Sun, Jan 26, 2014 at 7:24 PM, Matthew Moppett
<[email protected]>wrote:

> Hi Sok Ha.
>
> expr    = show send ++ "+" ++ show more ++ "=" show money
>
>
>
> On Sun, Jan 26, 2014 at 7:16 PM, Sok Ha Chang <[email protected]> wrote:
> > Hi.
> > I?m new to Haskell.
> > Use Haskell Platform on MacBook Air.
> > $ ghc --version
> > The Glorious Glasgow Haskell Compilation System, version 7.6.3
> >
> > I?m try to solve alphametic.
> > SEND + MORE = MONEY
> >
> > Here is code?
> >
> ----------------------------------------------------------------------------------------------------------
> > import Data.List
> >
> > decryp :: [Int] -> String -> String
> > decryp (s:e:n:d:o:r:y:[]) a =
> >         if send + more == money then expr:a else a
> >         where
> >                 send    = s * 1000 + e * 100 + n * 10 + d
> >                 more    = 1000 + o * 100 + r * 10 + e
> >                 money   = 10000 + o * 1000 + n * 100 + e * 10 + y
> >                 expr    = show send ++ "+" ++ show more ++ "=" show money
> >
> > decrypSolver :: [String]
> > decrypSolver =
> >         foldr decryp [] (permutations 7 [0, 2, 3, 4, 5, 6, 7, 8, 9])
> >
> ----------------------------------------------------------------------------------------------------------
> >
> > Error Messages is
> > ./decrypSolver.hs: line 10, column 60:
> >   Couldn't match expected type `(a0 -> String) -> Int -> [Char]'
> >               with actual type `[Char]'
> >   The function `"="' is applied to two arguments,
> >   but its type `[Char]' has none
> >   In the second argument of `(++)', namely `"=" show money'
> >   In the second argument of `(++)', namely
> >     `show more ++ "=" show money?
> >
> ----------------------------------------------------------------------------------------------------------
> >
> > How can I fix this?
> >
> > Thank you.
> >
> > Sincerely, S. Chang
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140126/44ceec39/attachment-0001.html>

------------------------------

Message: 4
Date: Sun, 26 Jan 2014 22:26:24 +0900
From: Sok Ha Chang <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Cc: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Error Message when trying to solve
        alphametic(SEND + MORE = MONEY)
Message-ID: <[email protected]>
Content-Type: text/plain;       charset=euc-kr

How stupid I am?
Thank you very much !
Have a nice day. 
Thanks, again. 

Sincerely, S. Chang


2014. 1. 26. ?? 9:24 Matthew Moppett <[email protected]> ??:

> Hi Sok Ha.
> 
> expr    = show send ++ "+" ++ show more ++ "=" show money
> 
> 
> 
>> On Sun, Jan 26, 2014 at 7:16 PM, Sok Ha Chang <[email protected]> wrote:
>> Hi.
>> I?m new to Haskell.
>> Use Haskell Platform on MacBook Air.
>> $ ghc --version
>> The Glorious Glasgow Haskell Compilation System, version 7.6.3
>> 
>> I?m try to solve alphametic.
>> SEND + MORE = MONEY
>> 
>> Here is code?
>> ----------------------------------------------------------------------------------------------------------
>> import Data.List
>> 
>> decryp :: [Int] -> String -> String
>> decryp (s:e:n:d:o:r:y:[]) a =
>>        if send + more == money then expr:a else a
>>        where
>>                send    = s * 1000 + e * 100 + n * 10 + d
>>                more    = 1000 + o * 100 + r * 10 + e
>>                money   = 10000 + o * 1000 + n * 100 + e * 10 + y
>>                expr    = show send ++ "+" ++ show more ++ "=" show money
>> 
>> decrypSolver :: [String]
>> decrypSolver =
>>        foldr decryp [] (permutations 7 [0, 2, 3, 4, 5, 6, 7, 8, 9])
>> ----------------------------------------------------------------------------------------------------------
>> 
>> Error Messages is
>> ./decrypSolver.hs: line 10, column 60:
>>  Couldn't match expected type `(a0 -> String) -> Int -> [Char]'
>>              with actual type `[Char]'
>>  The function `"="' is applied to two arguments,
>>  but its type `[Char]' has none
>>  In the second argument of `(++)', namely `"=" show money'
>>  In the second argument of `(++)', namely
>>    `show more ++ "=" show money?
>> ----------------------------------------------------------------------------------------------------------
>> 
>> How can I fix this?
>> 
>> Thank you.
>> 
>> Sincerely, S. Chang
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

Message: 5
Date: Sun, 26 Jan 2014 22:29:24 +0900
From: Sok Ha Chang <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Cc: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Error Message when trying to solve
        alphametic(SEND + MORE = MONEY)
Message-ID: <[email protected]>
Content-Type: text/plain; charset="euc-kr"

Thank you to kind help. 
>From now on, I will follow your way. 
Have a nice day. 
Thanks, again. 

Sincerely, S. Chang

2014. 1. 26. ?? 9:31 Matthew Moppett <[email protected]> ??:

> Sorry about the last post -- I accidentally clicked "send" before I'd written 
> my message.
> 
> Sok Ha:
> 
> expr    = show send ++ "+" ++ show more ++ "=" show money
> 
> should read
> 
> expr    = show send ++ "+" ++ show more ++ "=" ++ show money
> 
> 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).
> 
> 
>> On Sun, Jan 26, 2014 at 7:24 PM, Matthew Moppett <[email protected]> 
>> wrote:
>> Hi Sok Ha.
>> 
>> expr    = show send ++ "+" ++ show more ++ "=" show money
>> 
>> 
>> 
>> On Sun, Jan 26, 2014 at 7:16 PM, Sok Ha Chang <[email protected]> wrote:
>> > Hi.
>> > I?m new to Haskell.
>> > Use Haskell Platform on MacBook Air.
>> > $ ghc --version
>> > The Glorious Glasgow Haskell Compilation System, version 7.6.3
>> >
>> > I?m try to solve alphametic.
>> > SEND + MORE = MONEY
>> >
>> > Here is code?
>> > ----------------------------------------------------------------------------------------------------------
>> > import Data.List
>> >
>> > decryp :: [Int] -> String -> String
>> > decryp (s:e:n:d:o:r:y:[]) a =
>> >         if send + more == money then expr:a else a
>> >         where
>> >                 send    = s * 1000 + e * 100 + n * 10 + d
>> >                 more    = 1000 + o * 100 + r * 10 + e
>> >                 money   = 10000 + o * 1000 + n * 100 + e * 10 + y
>> >                 expr    = show send ++ "+" ++ show more ++ "=" show money
>> >
>> > decrypSolver :: [String]
>> > decrypSolver =
>> >         foldr decryp [] (permutations 7 [0, 2, 3, 4, 5, 6, 7, 8, 9])
>> > ----------------------------------------------------------------------------------------------------------
>> >
>> > Error Messages is
>> > ./decrypSolver.hs: line 10, column 60:
>> >   Couldn't match expected type `(a0 -> String) -> Int -> [Char]'
>> >               with actual type `[Char]'
>> >   The function `"="' is applied to two arguments,
>> >   but its type `[Char]' has none
>> >   In the second argument of `(++)', namely `"=" show money'
>> >   In the second argument of `(++)', namely
>> >     `show more ++ "=" show money?
>> > ----------------------------------------------------------------------------------------------------------
>> >
>> > How can I fix this?
>> >
>> > Thank you.
>> >
>> > Sincerely, S. Chang
>> > _______________________________________________
>> > Beginners mailing list
>> > [email protected]
>> > http://www.haskell.org/mailman/listinfo/beginners
> 
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140126/c1eb093d/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 67, Issue 25
*****************************************

Reply via email to