
iPhone, meet Haskell - sritchie
https://groups.google.com/forum/#!msg/haskell-cafe/agDRueqFUFk/7SKMNGnmKV0J
======
programminggeek
Wow, this looks super interesting. Would this be the first step in creating a
Haskell wrapper for doing native UI work, or is it more useful for games and
the like?

~~~
lukexi
Howdy!

I've been using
[https://github.com/jspahrsummers/ObjectiveHaskell/](https://github.com/jspahrsummers/ObjectiveHaskell/)
as my bridge between the two worlds (with some modifications for iOS that I'll
be posting soon). Haskell has a wonderful FFI that lets you easily call
C/Objective-C from Haskell and vice versa.

There's also Manuel Chakravarty's extremely exciting "Inline Objective-C"
project (coming soon) that allows you to embed Objective-C code directly into
Haskell, which would make it nearly effortless to speak fluently with Apple's
frameworks.
[https://gist.github.com/mchakravarty/4632567](https://gist.github.com/mchakravarty/4632567)

There are tons of awesome Haskell FRP implementations, from Netwire to Elerea
to Reactive-Banana: [http://ocharles.org.uk/blog/posts/2013-08-18-asteroids-
in-ne...](http://ocharles.org.uk/blog/posts/2013-08-18-asteroids-in-
netwire.html)

It would also be a lot of fun to get Helm running on iOS once they finish
their OpenGL backend. [http://helm-engine.org](http://helm-engine.org)

I definitely couldn't have pulled off my own project (SpaceTime, a multiplayer
app engine for iOS; announcement soon) without Haskell. I've been using the
development versions of GHC iOS to build it for over a year and it's been a
joy.

~~~
seanmcdirmid
Is it related to Fujimoto et al's space-time memory? There was also a project
called Stampede that that used a similar name to mean something completely
different. Or is it just a name?

~~~
mtrimpe
No; it's probably based around using confluent data structures.

------
wslh
I would love to also run the interpreter inside iOS to learn Haskell from a
tablet.

I will support a crowdfunding campaign.

~~~
martin_
Apple wouldn't permit this in the AppStore

~~~
ska
I don't think that's quite right, if I understand correctly you could have the
interpreter so long as there was no download and run of external code.

I'm sure I've seen a Lua environment like this.

~~~
ciferkey
Correct. Both python and lisp (Lisping) already have interpreters available as
well.

------
scrumper
This is interesting. I've been keen on experimenting with FRP for a while, and
now I can use it for 'real world' stuff on a platform I know I just might have
the push I need to jump into Haskell.

~~~
carterschonwald
please note: FRP is an idea, and while theres some interesting tools out there
for FRP, it is not always the right solution, and in many respects, "FRP done
Right" is still an open research problem.

That said, have fun and try things out! Share what you learn, and either way,
it'll be time enjoyably spent.

~~~
nightski
I think you could say the same thing about anything else in the software
world.

------
boothead
This is brilliant news!

Would it be possible to drop a cross compiled Haskell library into a Xamarin
project and call into it from the .Net (F#) world? That would be the killer
feature for me!

Also not much mention of android here - is it possible to target android with
Haskell at the moment?

~~~
lukexi
I believe this is the relevant project: [https://github.com/neurocyte/ghc-
android](https://github.com/neurocyte/ghc-android)

Joey Hess has been using it to build git-annex for Android. [http://git-
annex.branchable.com/install/Android/](http://git-
annex.branchable.com/install/Android/)

And much of the work we did simply improved support for cross-compilation in
general, so Android support should be better than ever! : )

~~~
boothead
Awesome! Any of you guys in London by the way?

------
dljsjr
Anybody here know, off the cuff, if the GHC packaged in Homebrew is compiled
correctly to utilize the wrapper scripts out of the box, or if I'd need to
build the cross-compiler myself as described in the linked documentation?

~~~
carterschonwald
Nope. I also strongly recommend against using the normal "brew" formulas for
haskell tools, its only by PROACTIVE efforts by mac using haskellers that the
standard brew aren't a complete disaster (or at least, wont' be a disaster,
soonish).

I strongly recommend using standard haskell binary distributions, such as
those prepared by GHC HQ, or the Haskell Platform folks, or perhaps any brew
Tap that Darin Morrison or Luke Ianni author. Do not use brew for haskell
tools (at least until they actually follow Darin Morrison's word to the T,
because they do janky stuff for haskell.)

~~~
dljsjr
Hmm. Well, looking at the Github repo activity, Darin is actively involved in
the GHC formulae these days. In fact he's actively involved in getting
Homebrew's GHC formula prepped for OS X Mavericks, which you note as an
upcoming issue below. So that's encouraging.

And while the stability of GHC/Haskell Platform was indeed questionable during
2012.2.0.0 and the beginning of 2012.4.0.0, they cleaned it up as time went
along and I haven't noticed any issues with it for the past 4 or 5 months. You
make a comment below about Haskell Platform being associated with specific GHC
releases, and AFAIK Homebrew actually freezes GHC at versions compatible with
the current release of Haskell Platform now. The reason I prefer to use the
package manager instead of the pre-distributed binaries is because it provides
for a deterministic and (theoretically) testable/repeatable upgrade path.

~~~
carterschonwald
1) you can very easily have multiple ghc's installed and have them not clobber
each other 2) use the binary packages if you want a default that just works.
If you look at the relevant ghc ticket on brew, they're very keen on modifying
the formulae against the recommendations of Darin very very easily. 3) I use
brew for many things, and even donated quite a bit to their kickstarter, but I
do not trust brew to do Haskell right.

------
lshemesh
Finally a chance to learn Haskell and iOS development at the same time! Will I
be able to do this all from a Linux machine or do I still need Apple hardware?

------
laureny
I'm going to withhold my excitement until I get proof that Apple will approve
GHC compiled binaries.

~~~
dljsjr
What would prevent them? Didn't they relax the cross-compile restrictions
like, 3 years ago? Adobe has a cross-compiler, that I know for sure.

In fact, I did a quick Google search before submitting this reply. Relevant
quote, from an Apple press release in 2010:

> In particular, we are relaxing all restrictions on the development tools
> used to create iOS apps, as long as the resulting apps do not download any
> code. This should give developers the flexibility they want, while
> preserving the security we need.

~~~
krichman
At least one of Ruby Motion or Xamarin Studio is compiling source code into
iPhone apps.

Furthermore iPhone apps are definitely allowed to embed interpreters (caveat:
no JITC's) and run scripts included with the binary or downloaded as part of
an in-app purchase.

------
Syssiphus
Brilliant, Thanks!

------
sluu99
iPhone users rejoice for bug-free code!

