Skip to main content
6 events
when toggle format what by license comment
Mar 28, 2017 at 21:08 comment added Eugleo I see. I did something similar, only without Maybe. I can rewrite it, but I would need to handle Nothing in every function now (I call the alphaPos and alphaChar directly from the functions). I'd rather make sure those function are alway passed only valid values to keep my code cleaner. What do you think?
Mar 28, 2017 at 4:35 comment added Zeta @Sh4rPEYE to answer your last question: a -> (b -> c) is the same as a -> b -> c, since (->) is right-associative. So (k -> a -> (k,a)) ->(k -> a -> (k,a)) is (k -> a -> (k,a)) -> k -> (a -> (k, a)) is (k -> a -> (k,a)) -> k -> a -> (k, a). For the dictionary: one way that comes to mind is to provide Char -> Maybe Int instead of baseOf (to get the correct Int if the character is valid) and Int -> Maybe Char to get the correct character (if the Int was valid).
Mar 27, 2017 at 21:04 comment added Eugleo How could I make it so that the ciphers use only one alphabet of 52 characters? Would I need to make some kind of dictionary manually? Also, how does the type signature for ignoreKey and onlyAscii work? As it is put now, shouldn't it denote that onlyAscii takes a function and returns one? How come in also accepts k and x as arguments?
Mar 27, 2017 at 19:45 comment added Eugleo You cannot imagine how grateful I am for this answer. There are so many sexy things in this; and how it all fits so nicely together! Pure magic. Also thank you very much for these exercises. As I'm really only beginning to learn Haskell, I don't yet know what Monads are. I'm just slowly reading through the Haskell book and Monads are in the very next chapter.
Mar 27, 2017 at 19:23 vote accept Eugleo
Mar 27, 2017 at 18:19 history answered Zeta CC BY-SA 3.0