77 lines
1.5 KiB
Plaintext
77 lines
1.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "482010f0-6af3-4f7b-a34a-3d1319a6f34e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"data Creature = Cat | Agda | Squid\n",
|
|
"instance Show Creature where\n",
|
|
" show Cat = \"🐈\"\n",
|
|
" show Agda = \"🐓\"\n",
|
|
" show Squid = \"🐙\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "622a85aa-ba4a-4b33-98da-ecbd8a1864e7",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"(💬) :: Creature -> String -> String\n",
|
|
"creature 💬 mjau = show creature ++ \" 💬 \" ++ mjau"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "191044ab-6288-4d5e-bdaa-89b31a41c0f7",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"🐈 💬 mjam"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"putStr $ Cat 💬 \"mjam\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "5e447529-f4ea-4e77-a9e4-d18326da2030",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"let 9 + 10 = 21 in print (9 "
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Haskell",
|
|
"language": "haskell",
|
|
"name": "haskell"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": "ihaskell",
|
|
"file_extension": ".hs",
|
|
"mimetype": "text/x-haskell",
|
|
"name": "haskell",
|
|
"pygments_lexer": "Haskell",
|
|
"version": "9.4.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|