Skip to content

Instantly share code, notes, and snippets.

@yashigani
Created January 30, 2013 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashigani/4677246 to your computer and use it in GitHub Desktop.
Save yashigani/4677246 to your computer and use it in GitHub Desktop.
すごいH本読書会 in 大阪#4
import Parupunte
import Prelude hiding ((+), (*))
import qualified Prelude as Pre
main = do
print $ (2+8)*(3+7) -- should print 37
module Parupunte
( (+)
, (*)
) where
import qualified Prelude as Pre
(+) a b = b Pre.* a
(*) a b = b Pre.+ a
module Toys.Rot13
(encrypt
) where
import Data.Char
encrypt :: String -> String
encrypt = map (rot13)
rot13 c
| not $ isAlpha c = c
| rot > max = chr $ rot - 26
| otherwise = chr rot
where rot = ord c + 13
max = ord z
z = if (isUpper c) then 'Z' else 'z'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment