heinrichapfelmus / hyper-haskell Goto Github PK
View Code? Open in Web Editor NEWThe strongly hyped Haskell interpreter.
License: Other
The strongly hyped Haskell interpreter.
License: Other
At the moment, people who wish to install HyperHaskell have to install two things:
For experienced users, this is the right approach, because they usually already have a Haskell environment (2) installed, and HyperHaskell should be compatible with it.
However, for absolute beginners, it is probably much more convenient to only install
The idea is that experienced users can still opt to install their own environment (2) and use it with HyperHaskell, but beginners have an easier time getting started if the front-end includes a default environment that does not have to be installed separately.
To implement the proposal, we have to bundle the following items with the application bundle
hyper-haskell-server
executablehyper
packageand add a new option "default" to the "Settings" pane of a worksheet. When the user chooses "default", then this bundled package database will be used for evaluating worksheet expressions. If the user chooses any other option ("cabal" or "stack"), then the already established procedure for that option applies, and the bundled package database is ignored.
Adding the "Settings" option is not difficult, but unfortunately, there is a problem with bundling: The executable and package database need to be relocatable, because, in general, people are free to move the front-end application bundle around, there is no fixed location at which it is installed. The problem is that at the time of this writing, Cabal does not fully support relocatable package databases.
Cabal has some preliminary support for relocatable packages, but it's not enough. It seems to work for cabal sandboxes
The GHC for MacOS X project has managed to make at least those packages relocatable that are shipped with GHC. Essentially, it does so by manually overwriting the paths in the package.conf.d
database. This may possible for a selected set of packages, but I'm not sure how it interacts with dynamic linking, external C libraries, data-file
, or executables. Preliminary experiments suggest that it's not straightforward.
I guess that Haskell for Mac found a (partial) solution to this problem already, but being a proprietary product, I'm not sure if they are willing to share their approach.
Apparently there is some kind of autoscale in the rendering process, which sometimes makes for absurd results:
-- Should fit on screen without scrolling, but does not.
dia $ circle 1 # scaleY 100 # scale 0.01
In general, any scale
applied to the entire diagram has no effect.
It also makes it so that a diagram does not maintain a constant size after operations that add other diagrams next to it. So:
-- Now it fits on the page! But adding a circle on the
-- right shouldn't change the size of anything on the left.
dia $ circle 1 # scaleY 100 # scale 0.01 ||| circle 1
Steps to reproduce:
stack install hyper hyper-haskell-server
) - global resolver is lts-11.15, and stack is in ~/.local/bin/Result:
Status: Could not load imports:
Interpreter not running (Error: 1)
Related observations:
If the stack path is set to the folder containing stack (rather than the full path) the error message is unhelpful:
It's not clear when changes to the stack path preference are actually applied; I could change which error I got by changing the interpreter back-end to cabal, reloading, and then changing back to stack.
Change a worksheet -> quit -> don't save -> program stays open
Currently I can only list module names in the Module imports
field:
Hyper.Extra
Diagrams.Prelude
I also need qualified imports. How about this syntax:
qualified Hyper.Extra as Extra
qualified Diagrams.Prelude as Diagrams
?
jupyter's nbconvert is very handy when rendering ipynb into HTML for report generation. It would be nice to have the same thing for hyper-haskell notebooks. To that end I have a dummy implementation here: https://github.com/ejconlon/hyper-eval . (I still have to set cwd right and use stack.yaml and such to configure the interpreter environment, but it works for Prelude examples.) Let me know if this is a feature you'd like to see!
let x = 5
results in
<hint>:3:23: error: parse error on input ‘}’
Using just
x = 5
results in the very helpful message:
<hint>:2:3: error:
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
:)
Electron <= 11 are EOL, does hyper-haskell
work with electron >= 12?
$ stack --stack-yaml=haskell/stack.yaml build
Fails with this error:
...
aeson-0.9.0.1: configure
aeson-0.9.0.1: build
wai-logger-2.2.5: copy/register
http-date-0.0.6.1: copy/register
aeson-0.9.0.1: copy/register
Progress: 5/29'cabal copy' failed. Error message:
-- While building package hyper-0.1.0.0 using:
/Users/homam/.stack/setup-exe-cache/x86_64-osx/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.5.0 copy
Process exited with code: ExitFailure 1
Logs have been written to: /Users/homam/dev/haskell/hyper-haskell/haskell/.stack-work/logs/hyper-0.1.0.0.log
Configuring hyper-0.1.0.0...
Warning: The 'license-file' field refers to the file 'LICENSE' which does not
exist.
Preprocessing library hyper-0.1.0.0...
src/Hyper/Internal.hs:1:33: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
In-place registering hyper-0.1.0.0...
setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: LICENSE: does not exist
One possible cause of this issue is:
* No module named "Main". The 'main-is' source file should usually have a header indicating that it's a 'Main' module.
Stack version: Version 1.1.2 x86_64 hpack-0.14.0
I've only heard of this but don't have any experience with it myself.
It's documented here: https://docs.travis-ci.com/user/deployment/releases
For presentations I'd like to increase the font size, either by hitting Ctrl-+ at runtime or in a configuration file. Maybe that's already possible via Electron?
After opening a worksheet with associated .hs
file (Main
module) and too soon evaluating a cell, I get:
<interactive>:2:1: Not in scope: `Hyper.displayIO'
<interactive>:3:1: Not in scope: `mooreImg'
<interactive>:5:38: Not in scope: type constructor or class `IO'
<interactive>:5:41:
Not in scope: type constructor or class `Graphic'
A remedy could be
Currently when I alter the module imports I have to choose "Reload imports and options" from the "Evaluation" menu. I'd prefer to just hit Ctrl-Return like in the evaluation cells in order to trigger reloading imports.
I propose that Hyper.html takes a Blaze.Html type as input.
This would mean that Hyper has to decide which HTML standard to use, but the current mixing of standards is certainly not better.
For Hyper.Display
instances for container types it would be nicer to work on Blaze.Html
. I could then call Hyper.display
on the container elements and arrange the obtained HTML objects on the HTML level. Blaze.Html
would be better for composability than Text.
I was very impressed by your demo of HyperHaskell at ICFP, Heinrich! I have just tried installing it (Mac 10.14.5, GHC 8.4.3) using cabal. The install went smoothly, but on starting up the front end, the Imports and options -> Status box reports
Interpreter not running (Error: spawn /Users/jg/.cabal/bin/hyper-haskell-server ENOENT)
Indeed, that path won't find my server:
jg$ which hyper-haskell-server
/Users/jg/Library/Haskell/bin/hyper-haskell-server
jg$ ls ~/.cabal/
config logs where-is-my-stuff.txt config.platform packages
Did I do something wrong?
It seems that when using stack hyper-haskell doesn't know where to look for packages (or similarly I don't know where it's looking for packages). I've run stack build csound-expression
from the haskell/
directory before running make run
from the project root and then opening the Csound.hhs
worksheet. After those steps I get the error:
Status: Could not load imports: <no location info>: Could not find module ‘Csound.Patch’ Use -v to see a list of the files searched for.
Suppose I have generated the following plotly
<!DOCTYPE HTML><html><head><meta charset="utf-8"><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head><body><div id="myContour"></div><script>Plotly.newPlot('myContour', [{"z":[[10,10.625,12.5,15.625,20],[5.625,6.25,8.125,11.25,15.625],[2.5,3.125,5,8.125,12.5],[0.625,1.25,3.125,6.25,10.625],[0,0.625,2.5,5.625,10]],"x":[-9,-6,-5,-3,-1],"type":"contour","orientation":"h","y":[0,1,4,5,7]}],{}, {displayModeBar: false});</script></body></html>
I can render this in my browser. Can it be rendered in a cell in HyperHaskell? I have failed to do this in IHaskell although I believe it to be possible.
How about Display
instances for lists and tuples? This would simplify displaying the results of functions that return multiple results. E.g. the tuple members could be displayed in tiers.
These can probably modeled just like text cells. I have no idea whether the JS part supports URL-loading, though.
In the meantime I found a stop-gap solution for showing locally stored html/svg files:
import qualified Data.Text.IO (readFile)
import System.IO.Unsafe (unsafePerformIO)
readSVG = html . unsafePerformIO . Data.Text.IO.readFile
Then in an evaluation cell you can put readSVG "my.svg"
. The bad thing is that I have to re-evaluate those cells after opening the worksheet.
Currently hyper-haskell uses a custom JSON format for its notebooks.
What about to also support loading Haskell modules, i.e. parsing LANGUAGE pragmas, import statements and top-level definitions? It would simplify to switch between hyper-haskell and GHCi.
A problem would be that the user might expect that all module information and even formatting is maintained when hyper-haskell writes back an edited module. Also there must be a way to store cell inputs like this one:
test <- return “Test”
test
How ever I build the back end, stack or cabal sandbox -- when I start the front end and ask for a new worksheet I get the following error:
WontCompile [GhcError {errMsg = "<no location info>: error:\n Could not find module \8216Hyper\8217\n Use -v to see a list of the files searched for."}] hyper-haskell-server: hyper-haskell-server: signal: 15 Interpreter stopped (Exit code 1)
I installed the hyper-haskell-server with Haskell-platform-8.6.3 as follows:
cabal unpack hyper-haskell-server ——> change the dependencies in the .cabal file ——> cabal build
However, I got the following errors:
Failed to install hyper-haskell-server-0.2.1.0
Build log ( D:\Program Files\Haskell Platform\cabal\logs\ghc-8.6.3\hyper-haskell-server-0.2.1.0-CozCChDfS9X97YEz3apKeV.log ):
Preprocessing executable 'hyper-haskell-server' for hyper-haskell-server-0.2.1.0..
Building executable 'hyper-haskell-server' for hyper-haskell-server-0.2.1.0..
[1 of 1] Compiling Main ( Main.hs, dist\build\hyper-haskell-server\hyper-haskell-server-tmp\Main.o )
Linking dist\build\hyper-haskell-server\hyper-haskell-server.exe ...
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(Socket.o):fake:(.text+0x12ba1):对‘acceptNewSock’未定义的引用 (means undefined reference to 'acceptNewSock'. The following are the silimar error message.)
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(Socket.o):fake:(.text+0x12e7a):对‘newAcceptParams’未定义的引用
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(Socket.o):fake:(.text+0x12e8e):对‘acceptDoProc’未定义的引用
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(Internal.o):fake:(.text+0x18b):对‘initWinSock’未定义的引用
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(Internal.o):fake:(.text+0x383):对‘getWSErrorDescr’未定义的引用
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(HsNet.o):HsNet.c:(.text+0x13):对‘__imp_getnameinfo’未定义的引用
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(HsNet.o):HsNet.c:(.text+0x23):对‘__imp_getaddrinfo’未定义的引用
D:\Program Files\Haskell Platform\cabal\x86_64-windows-ghc-8.6.3\network-2.8.0.0-2CyxvHbPvRZAIM6yl0QQaq/libHSnetwork-2.8.0.0-2CyxvHbPv
RZAIM6yl0QQaq.a(HsNet.o):HsNet.c:(.text+0x33):对‘__imp_freeaddrinfo’未定义的引用
collect2.exe: error: ld returned 1 exit status
gcc.exe' failed in phase
Linker'. (Exit code: 1)
cabal: Leaving directory '.'
My cabal version is 2.4.1.0, ghc 8.6.3.
I think this is probably due to the newest haskell platform I used. But I don't know how to fix it.
Thanks for any help!
$ NIXPKGS_ALLOW_BROKEN=1 nix-env -if haskell/hyper-haskell-server.nix
error: attribute 'mkDerivation' missing
at /home/thielema/programming/haskell-other/hyper-haskell/haskell/hyper-haskell-server.nix:29:9:
28|
29| drv = pkgs.mkDerivation {
| ^
30| pname = "hyper-haskell-server";
I am on channel nixpkgs-23.11.
Here's my experience trying to get hyper-haskell to run on linux.
First off I had to add $(STACK) setup
before $(STACK) build
because I didn't have the correct version of ghc installed.
Secondly, when I try to run the app using electron nothing happens. If I point electron to one of the html files in the app directory I get a window displaying that page, for instance worksheet.html. But the whole app doesn't want to start. I've tried it using electron 1.4.0.
hyper-extra forbids compilation with QuickCheck < 2.14, but builds fine with 2.14.2.
Hi
I tried to install hyper-haskell for the first time, on a blank ubuntu (Xubuntu 16.04.1 LTS).
sudo apt-get install haskell-platform
sudo apt-get install haskell-stack
sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm
cabal update
cabal install hyper-haskell-server
sudo npm install [email protected] -g
Electron seems correctly installed. I can run /usr/local/lib/node_modules/electron/dist/electron, which opens an electron window asking to specify an app.
Added export PATH=$HOME/.cabal/bin:"$PATH"
Then hyper-haskel-server runs fine, with Waiting for Haskell expression (but can't be killed with ctrl-c).
cd ~/hask/hyper-haskell-0.1.0.0
updated Makefile to ELECTRON=/usr/local/lib/node_modules/electron/dist/electron
make run
All seems fine until '/usr/local/lib/node_modules/electron/dist/electron app', which I expected to open a window, but nothing happens and it also does not terminate. What did I miss?
As I mentioned on #4 I had to run this differently from the instructions to get a window to show up:
$ make interpreter && (cd worksheets && TESTING=y exec electron ../app)
This produces the following output:
stack --stack-yaml=haskell/stack.yaml build
Setting phasers to stun... (port 14200) (ctrl-c to quit)
Waiting for Haskell expression
Got Haskell expression, evaluating
Wrote result
Waiting for Haskell expression
Got Haskell expression, evaluating
Wrote result
Waiting for Haskell expression
WontCompile [GhcError {errMsg = "<no location info>:\n Could not find module `Csound.Base'\n Use -v to see a list of the files searched for."}]
If I try to evaluate hello
, I get a whole lot of undefined symbols:
<interactive>:2:1: Not in scope: `Hyper.displayIO'
<interactive>:3:1: Not in scope: `hello'
<interactive>:5:38: Not in scope: type constructor or class `IO'
<interactive>:5:41:
Not in scope: type constructor or class `Graphic'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.