Comments (7)
Sounds good.
Just FYI, quickcheck works just fine with a basic example using the port you made!
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
import Test.QuickCheck (quickCheck)
main :: Effect Unit
main = do
quickCheck \n -> n + 1 == 1 + n
from purescript-python.
Thanks for your interest!
For example, to support purescript-enum
, we write a git(it can be bitbucket/gitlab hosted one) project:
purescript-enums.py
Check its project structure and the correspondence between it(the FFI project) and purescript-enum
Then you can register it here: ffi index mirror
We solve FFI issues by using an FFI index mirror, and you can also fork it to make your own one, if you want you can ask us more details, and if not just make a PR to ffi index mirror
from purescript-python.
Besides, so far it seems that you cannot implement purescript-quickcheck because it seems quickcheck used the internal representation of chars and strings.
We now map purescript strings to python strings, but in python, a string is an array of char
s, and can be randomly indexed, while in languages "correctly implemented unicode strings", a char in a string can be 1 or 3 byte(s), where a string is essentially an array of uint8 and cannot be randomly indexed.
from purescript-python.
@mikesol we now working on purescript-quickcheck
from purescript-python.
Great! I just saw it on your github. So if I understand correctly, the blocker is their use of the String
type? While I still need to dig deeper into this project, it seems that it would be useful to have interop between purescript String
and python-purescript, as lots of purescript projects use String
. I agree that native support for unicode strings would be really nice, as it is a feature needed by most apps that treat client data like names and addresses.
If you could write up a separate issue for this problem, I can take a look at it and see if I can dive in!
from purescript-python.
@mikesol
Hello!
So if I understand correctly, the blocker is their use of the String type?
You're right.
I agree that native support for unicode strings would be really nice, as it is a feature needed by most apps that treat client data like names and addresses.
We now map purescript String
to Python str
, which does have native unicode support. The problem here is, python's string representation is different from JS ones, that Python cannot expose string's internal code units to users.
Python strings are aligned strings(this can be memory inefficient), hence can be randomly accessed. Each character in a Python string is not fixed length, unlike a code unit.
We may use python bytes
for purescript String
, which have code units, but it will make things harder to support EFFICIENT native unicode. This issue has some details, if you want we can talk.
I received your email and I'm glad to have a chat with people from your company. However recently my research is very very urgent.. If possible I want to postpone it for a few days..
from purescript-python.
@mikesol I don't remember if I've told you some particular things about FFI implementation, but I'd add it here:
null
in JavaScript maps toNone
in Python,Unit
in PureScript maps to()
in Python.- A JavaScript function
function f(x) { ... }
should be writtendef f(x = None): ...
in python.
The list might be extended in the future, which is for being compatible because some purescript libraries do use some JS-specific behaviors.
from purescript-python.
Related Issues (20)
- avoid generating pretty-printed SExpr
- use passing directory for CI build HOT 6
- CI build error
- register concerned ffi-repos and fix ci HOT 1
- Could have other/original licence HOT 4
- purescript-python up-to-date HOT 1
- Nix-based installer
- unicode string representation HOT 1
- A tracker for the membership of purescript-python organization
- Better debugging when lambdas are called HOT 4
- spago run does codegen HOT 2
- Optimizations to avoid python recursion limit HOT 3
- Troubleshoot: Execution Not Sync to Latest Code HOT 1
- spago passing arguments to 'pspy --run'
- Code is generated on "spago run" (expected that to happen on "spago build") HOT 2
- Documenting how to construct algebraic datatypes from python HOT 5
- How to make it support windows platform? HOT 2
- purescript/maybe segfaults at runtime HOT 9
- Trying to run a helloworld program, get "Backend "pspy" exited with error:2" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purescript-python.