All Projects โ†’ vivshaw โ†’ three-wise-monkeys

vivshaw / three-wise-monkeys

Licence: MIT license
You've heard of the SKI combinators... How about the ๐Ÿ™Š๐Ÿ™‰๐Ÿ™Š combinators?

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to three-wise-monkeys

emojimix
๐Ÿค– emojimix implemented in Svelte ๐Ÿค–
Stars: โœญ 24 (-11.11%)
Mutual labels:  emoji
recyclebin
โ™ป๏ธ measures usage of a particular term on twitter
Stars: โœญ 21 (-22.22%)
Mutual labels:  emoji
emojityper
Github said "Error saving your changes: Description contains unicode characters above 0xffff" when I put the FACE LAUGHING WITH TEARS OF JOY emoji in this box
Stars: โœญ 76 (+181.48%)
Mutual labels:  emoji
emoji-data-python
Emoji toolkit for python. Parse emoji from colons and much more...
Stars: โœญ 39 (+44.44%)
Mutual labels:  emoji
react-reactions
๐Ÿ˜ฒ Create custom reaction pickers and counters or use your favorites!
Stars: โœญ 34 (+25.93%)
Mutual labels:  emoji
gomoji
Helpful functions to work with emoji in Golang
Stars: โœญ 63 (+133.33%)
Mutual labels:  emoji
react-emoji-input
๐Ÿ˜‚ Emoji suggestions like the textareas in GitHub
Stars: โœญ 29 (+7.41%)
Mutual labels:  emoji
noto-color-emoji-font
Color emoji SVGinOT font using Noto emoji, with multiple releases, such as Lollipop and Nougat. Linux/MacOS/Windows
Stars: โœญ 32 (+18.52%)
Mutual labels:  emoji
emoji-unicode
๐Ÿค” Search & Replace unicode emojis. Supports Unicode 10
Stars: โœญ 20 (-25.93%)
Mutual labels:  emoji
domino
a tool for collaging thoughts
Stars: โœญ 83 (+207.41%)
Mutual labels:  emoji
emojicodes
An extension to use emoji codes in your Sphinx documentation! ๐Ÿ˜
Stars: โœญ 39 (+44.44%)
Mutual labels:  emoji
md-file-tree
Generate markdown list of all the files in a directory. Now also with emoji ๐Ÿ“‚ ๐Ÿ“„
Stars: โœญ 130 (+381.48%)
Mutual labels:  emoji
favioli
Emoji Favicons for the web. ๐Ÿ‘Š๐Ÿคฏ
Stars: โœญ 55 (+103.7%)
Mutual labels:  emoji
WeiboEmoji
Weibo Emoji is a repository for saving and sharing most Emoji images that are used/were previously used by the app Weibo.
Stars: โœญ 17 (-37.04%)
Mutual labels:  emoji
animated-emoji-gen
The tool makes it easy to create animated GIFs of Slack custom emoji.
Stars: โœญ 53 (+96.3%)
Mutual labels:  emoji
ansi-to-svg
๐Ÿ˜น convert ANSI Escaped CLI strings to SVGs
Stars: โœญ 18 (-33.33%)
Mutual labels:  emoji
EmojiKeyBoard
่‡ชๅฎšไน‰่กจๆƒ…้”ฎ็›˜(ๆ”ฏๆŒ็ณป็ปŸ่กจๆƒ…, ๅ›พ็‰‡่กจๆƒ…)๏ผŒไป…ไพ›ๅ‚่€ƒๅญฆไน ~
Stars: โœญ 36 (+33.33%)
Mutual labels:  emoji
EmojiReader
A simple tool to recognize Emoji in string. (JavaScript & Java)
Stars: โœญ 61 (+125.93%)
Mutual labels:  emoji
emojis
An emoji management bot for Discord.
Stars: โœญ 18 (-33.33%)
Mutual labels:  emoji
whatsapp-bot
Made with Python and Selenium, can be used to send multiple messages and send messages as characters made of emojis
Stars: โœญ 34 (+25.93%)
Mutual labels:  emoji

๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š Three Wise Monkeys ๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š

An exercise in obfuscated Haskell vis-a-vis a primate proverb.

What does it do?

This program simply prints the text "siddhartha" using the SKI combinator calculus. This is further obfuscated through the abuse of arbitrary Unicode identifiers, as well as the the C preprocessor.

The key to understanding how this works goes like so:

-- What the heck is this?
wisdom See no e vil is (no -> e -> vil) -> (no -> e) -> no -> vil
-- Well, take a look at the S combinator:
type S f x y = (f -> x -> y) -> (f -> x) -> f -> y
-- Yup, the first monkey is just an obfuscated S combinator
(๐Ÿ™ˆ) :: See no e vil

-- So this one should be easier:
wisdom Hear no evil is no -> evil -> no
-- Compare to the K combinator:
type K x y = x -> y -> x
-- Yup, the second monkey is just the K combinator (a.k.a const)
(๐Ÿ™‰) :: Hear no evil

From here, we can construct the I combinator ๐Ÿ™Š (a.k.a. id), and have the whole of the SKI combinator calculus at our disposal. Additionally, I define the B and C combinators for ease of use, as ๐Ÿต and ๐Ÿ’ respectively. From that point the rest is not too complex. If you wish to see which chunks of code correspond to which letters, simply undo all the ASCII art made from the monkeys and linebreak each time you see a ton of closing parenthesis, then study the repeating monkey patterns leading up to them. It will become clear that there are 10 main blobs (one for each character in "siddhartha") and each repeats the pattern ((๐Ÿ™ˆ)(๐Ÿต) equal to the character's ASCII codepoint minus 10. This rather telling pattern should make it obvious how the rest works.

Obfuscation techniqes

Unicode abuse

Haskell is generous. Haskell loves you. Haskell allows arbitrary Unicode characters in identifiers and operators, because you deserve it.

  • Type names and variable names can have any Unicode letter or number in them, with the caveat that types must start with a Capital letter, and variables must start with a lowercase letter. As it turns out, you can use things like Hanzi, hangul, or kana as well- Haskell simply treats them as lowercase letters.
  • Operator names can have any non-special unicode symbol (pretty much everything except ()|,;[]`{}_:"'), including emoji. However YMMV - some symbols or combinations thereof will make GHC wig out, especially anything 'bracket-like'.

{-# LANGUAGE CPP #-}

With this GHC extension, we can run the C preprocessor on our Haskell source before compilation. This allows a large number of unusual substitutions that don't need to follow the rules of regular Haskell syntax, but do require obeying C identifier rules. As an added bonus, the behavior may be platform-dependent based on whether your system runs clang or gcc.

the SKI combinatory calculus

anything written with combinatory logic is obfuscated by default lol

Do you have any suggestions to further beautiful, comfound, or obfuscate?

PR's welcome if there's any other "FUN" things you can make GHC do. I didn't look too far into TH, rewrite rules, or RebindableSyntax.

Credit where credit is due

Inspiration is due to Sami Hangaslammi's SKI Hello World and the technique used to construct it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].