Skip to main content

Stuck with Python but you actually want to use Haskell?

This is a silly package that (ab)uses Python operator overloading to reproduce beloved features from functional programming.

You can do:

Currying

@curry
def f(a, b, c):
  return a + b + c
  
f(1, 2, 3)
Out[0]: 6

g = f << 1
g << 2 << 3
Out[1]:  6

f << 1 << 2 <<< 3
Out[2]: 6

Infix Notation

@infix
def plus(a, b):
  return a + b
  
1 |plus| 2
Out[0]: 3

Functional Programming!

@curry
def foldl(fn, x, xs):
    return x if not xs else fold << fn << (x |fn| xs[0]) << xs[1:]
    
sum = foldl << plus << 0

sum([1, 2, 3])
Out[0]: 6

Big credit goes to these guys:

Metadata

Release files for pyskell 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyskell 0.0.1
File Size Uploaded
pyskell-0.0.1.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyskell 0.0.1
File Interpreter ABI Platform
pyskell-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / pyskell-0.0.1.tar.gz

Download URL pyskell-0.0.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6cc4902ba2ca13c33de7fb8cd14c4fb47667ec8a31dff23b3752f340506ff5e2
BLAKE2b-256 checksum
How to use checksums
208a87aa53d8273ab895e140058ee35b6cb1e934ba59ce377a7bafc1ea410bdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release files / pyskell-0.0.1-py3-none-any.whl

Download URL pyskell-0.0.1-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
193b08801370d8db3937999bfc3294183f59662d03d30f6f0aa4b1dd16461cb7
BLAKE2b-256 checksum
How to use checksums
2462f2bdeba4f47e06bf99d4d84c5aab5d82ac3aad573f1b3cfe225e1b4016bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page