Skip to main content

# Stuck with Python but you actually want to use Haskell?

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyskell-0.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyskell-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pyskell-0.0.1.tar.gz.

File metadata

  • Download URL: pyskell-0.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for pyskell-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6cc4902ba2ca13c33de7fb8cd14c4fb47667ec8a31dff23b3752f340506ff5e2
MD5 633158d454ef0b4ff9aece385db2b7f3
BLAKE2b-256 208a87aa53d8273ab895e140058ee35b6cb1e934ba59ce377a7bafc1ea410bdb

See more details on using hashes here.

File details

Details for the file pyskell-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyskell-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for pyskell-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 193b08801370d8db3937999bfc3294183f59662d03d30f6f0aa4b1dd16461cb7
MD5 c90d429af1f04e35e639b9227c41e648
BLAKE2b-256 2462f2bdeba4f47e06bf99d4d84c5aab5d82ac3aad573f1b3cfe225e1b4016bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page