Skip to content

Instantly share code, notes, and snippets.

@aszlig
Last active August 29, 2015 14:18
Show Gist options
  • Save aszlig/e311a2e60db4a9481947 to your computer and use it in GitHub Desktop.
Save aszlig/e311a2e60db4a9481947 to your computer and use it in GitHub Desktop.
Haskell Ascii Semantic Image, welcome to .__
|_) _, ,_ _ o ._ _.
This file is an attempt to | (_| | '-. | | | (_|
describe the HASI format and ' ' ' `-' ' ' ' _;
also serves as a fixture for | | .-- | | ( )
running our tests. |--| |-- | | `o o'
| | |__ |__ |__ vvv
So, let's go: ' ' ' ' ' ' ^^^
Our file format consists of two basic building blocks:
______ .-.
| | |_,' .--. . . .-. .-.
| | <--- | `. | | `\_/' |-' `-.
|______| |_.' |__| _/ \_ |__ ._;
... aaaaaaand:
/|\
/' | `\ .--.
| | | . . .--. . . . .-.
| <------- |--| |/' |/' | | | | | `-.
| | | | | |__| `\|/' ._;
|
Every arrow can either point from one box to another:
_______ _______
| | | |
| A | ------> | B |
|_______| |_______|
Or it can be used to annotate a specific point:
_______
| |
| x | <-+- this is X!
|_______| |
/|\ |
`-------'
... or even a region:
_______
| | <-- Does anyone have an idea about why
| xxxx |-. this looks like a bottle of beer?
| xxxx | |--+- so much X! WOW!
| xxxx |-' | (*) (*)
| | | o
| | | _________
|_______| | \|||||||/
|--| | `-----'
`-------'
If both boxes are directly next to each other, an arrow is implied:
_________ _________ _________
| | | |
| A | B | C |
|_________|_________|_________|
/|\
|
see this border?
So It's like connecting boxes A -> B -> C.
Boxes can have different styles/shapes:
+-----+ ,----. ___ ..... /---\ .----. ____
| | | | | | : : | | | | | |
| | | | | | : : | | | | | |
+-----+ `----' |___| :...: \---/ |____| `----'
Arrows can have different styles/shapes as well:
,/ ___\ <==== |
----> <-------- / \ | / .
`\ . `v' /|\
\\ /|\ | .------> | .^. |
=====> | \|/ `.__ ' | | |
// V |
They may have titles/headings:
.===============. In this case it's just important
| MEGA Headline | that the title has to be at the top
|===============| of a box and consists of only one
| | line.
| |
| |
|_______________|
More compact variants are also allowed:
.--[ heading ]--. .-< heading >-. .-{ heading }-.
| | | | | |
`---------------' `-------------' `-------------'
.--( heading )--. .-= heading =-. .-- heading --.
| | | | | |
`---------------' `-------------' `-------------'
.--[H]--. This is a one character variant of one of the
| | variants above. In this case, white space is
`-------' NOT stripped, so you can even have something
like this: .--[ ]--.
| | Why is this useful you
`-------' say? Think about fonts
where you want to have
space assigned to the
contents of a box.
And can even be nested:
.-----------------------.
| ........... |
| +-----+ : .-----. : |
| | | : | .-. | : |
| | | : | `-' | : |
| +-----+ : `-----' : |
| :.........: |
|_______________________|
Of course, they may contain content:
.------------------------------.
| .------------------. |
| (.-.) / Yay! I'm a thunk! | |
| o o -'--------------------' |
| `-' |
| `\|/' meow! |
| | `o'-; |
| / \ ' ' |
`-------------.----------------'
/|\
`-- Yes, that's Schroedinger`s cat!
We initially talked about parsing hell, because if you look
at the arrow above, the bottom edge of the box is broken.
Yes, it is VALID as h^Hwell.
Combined together, we can build "slightly" more complex things:
.============================================================.
| This is the outer world! Weeeeeeeeeeeeeeeeeeeeeee... |
|============================================================|
| .--------------------------. |
| Imagine these | `. `.,' , | |
| clouds up here ------------> | ,-,-.-,-. --_`.-'-'_-- | |
| | ,' ,'----: ----| |
| And other stuff below | `-.-'.'-' .---''--`.-. | |
| ||||||||||||||||||||| `--------------------------' |
| VVVVVVVVVVVVVVVVVVVVV |
| .========================================================. |
| | Balloon, really? Are you sure? | |
| |========================================================| |
| | this is not quite | |
| | |-----| .--- the center of the | |
| | ____| ,--|--------| balloon, but who | |
| | _-' | | | | cares anyway? | |
| | _-' | | | `\_ | |
| | b .' .--|-\|/-|----. "-___ | |
| | a --'--------| _._ | .---. \ | |
| | l | | ,' `. | `-. `. `\ | |
| | l | | : ; |<--' | `\ | |
| | o -----------| `-.-' | .' | | |
| | o _.-->| : | _.' ,---_ | | |
| | n .' `->| : | .' `. `. | | |
| | `. `-------------' `---. | | | | |
| | `. /|\ | | `--' | |
| | `. | `---' | |
| | |,-----' unqualified comment | |
| | cord | |
| | | |
| `--------------------------------------------------------' |
| | |
| | |
| | +---------+ |
a | \|/ .-----> | another | another X here! |
b | ~. .------. | | | | |
o | .~. | mini | | | B O X |<----| |
v /| ~.~ | box! |----' +---------+ | | |
e || ~ ~.. `------' ^ /|\ | | _.-,_ |
|| _||__ see the B! --|----' | ( ) |
g || ,' `. `-------' ( _,' |
r || '| [] [] |` `~| |
o || | .-. | | |
u \| ,,',|___|-|_|,,'',,','',',',,',','',',',,','',,',',''|,,','|
n | .=======================================================. |
d | | Underground | |
| |=======================================================| |
| | | |___________|| ,''`|' `'.`' | |
| | | ,-----------.|' | |
| |------' |---. .---.| ______________ |_ |
| |------| | | ,.,.,;.,',..' `..;.,| ||
| | | |---' `---'|`,__..-.-.-.`.______________,'._..|-||
| `-------------------------------------------------------' ||
| |-| |----------------|-.__.-'|
| pipe... where's mario? p o n d |
`------------------------------------------------------------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment