Jump to content

Błąd kompilacji Haskella

Bartosz Wójcik

Recommended Posts

Mam mały problem z kompilacją kodu:

-- encrypted with https://www.stringencrypt.com (v1.0.0) [Haskell]
module Main where
import qualified Data.Char
import qualified Data.Bits
main = do
  putStrLn $ ffffff
-- ffffff = "abc!"
ffffff = zipWith f [0..] [ 0x41F6, 0x41F0, 0x41EE, 0x41AF ]
    f wlyxp wflco = let rhsfn0 = wflco
                        rhsfn1 = rhsfn0 + wlyxp
                        rhsfn2 = rhsfn1 `Data.Bits.xor` 0x531D
                        rhsfn3 = rhsfn2 - 0xC028
                        rhsfn4 = rhsfn3 + wlyxp
                        rhsfn5 = rhsfn4 `Data.Bits.xor` 0x1851
                        rhsfn6 = rhsfn5 + wlyxp
                        rhsfn7 = rhsfn6 - wlyxp
                        rhsfn8 = rhsfn7 `Data.Bits.xor` wlyxp
                        rhsfn9 = Data.Bits.complement rhsfn8
                        rhsfn10 = rhsfn9 + 0x6B0A
                        rhsfn11 = rhsfn10 + wlyxp
                        rhsfn12 = rhsfn11 `Data.Bits.xor` 0x2016
                        rhsfn13 = rhsfn12 `Data.Bits.xor` wlyxp
                    in Data.Char.chr ( Data.Bits..&. 0xFFFF)

Ideone wypluwa mi taki błąd

[1 of 1] Compiling Main             ( prog.hs, prog.o )

    Couldn't match expected type `Int' with actual type `a0 -> a0'
    In the first argument of `Data.Char.chr', namely
      `(Data.Bits..&. 65535)'
    In the expression: Data.Char.chr (Data.Bits..&. 65535)
    In the expression:
        rhsfn0 = wflco
        rhsfn1 = rhsfn0 + wlyxp
        rhsfn2 = rhsfn1 `Data.Bits.xor` 21277
      in Data.Char.chr (Data.Bits..&. 65535)

Jako, że moja znajomość Haskella jest znikoma może ktoś wie jak to poprawić?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...