Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

PyHaskell

Rewriting Haskell modules and libraries in Python.

We care about the function signatures, not the implementation. For example, consider a function in Haskell that operates on what is semantically a list, taking other arguments, and then returns a list.

We don't care how Haskell did it. We'll do the correct semantic thing for Python.

Let's start with Prelude!

Reference the builtins from the builtins module:

importbuiltinsdefall(fn, a) ->bool:
"""all :: Foldable t => (a -> Bool) -> t a -> Bool """returnbuiltins.all(fn(i) foriina)

Let's keep them in order that we get them from the following command:

Prelude>:browse Prelude

Functions that aren't legal python names (keywords or symbols) should get a name that uses a short nickname for it.

  • bang means !
  • hat means ^
  • cash means $
  • ampersand means & (unless we can get away with and)

For example:

defbangbang(list_of_a, integer) ->'a':
"""(!!) :: [a] -> Int -> a """

About

Rewriting Haskell modules and libraries in Python

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages