[Haskell-beginners] Evaluation oddity

Francesco Ariis fa-ml at ariis.it
Sun Feb 6 19:02:47 UTC 2022


Hello Otto,

Il 06 febbraio 2022 alle 19:00 Torsten Otto ha scritto:
> When I call 
> 
> *Main> diffieH 23 16 20
> 13
> 
> and use the result in
> 
> *Main> encipher "abc" 13
> „nop"
> 
> I get the letters to be expected. However, when I combine these into
> 
> > start text p a b = encipher text (diffieH p a b)
> 
> *Main> start "abc" 23 16 20
> „efg"
> 
> the result changes. 

You should always write top level signatures by hand in your
code. What is the signature that you want for `diffieH`?
This is the inferred one

    λ> :t diffieH
    diffieH :: (Integral a, Integral b) => a -> b -> a -> a


More information about the Beginners mailing list