Difference between revisions of "User:JRV"
Line 2: | Line 2: | ||
---- |
---- |
||
+ | '''Xcode, Cocoa, and Haskell together''' |
||
− | There is some interest in using Haskell on the Mac with a real Mac (Aqua) |
||
− | interface. There are a couple of things out there which are mentioned on |
||
⚫ | |||
− | reading about, these left me in need of the missing tutorial, rather than |
||
− | the ability to write one. But that's another topic. |
||
+ | John Velman |
||
− | This tutorial doesn't meet the needs of the Missing tutorial page. It is |
||
− | much less ambitious. |
||
⚫ | |||
⚫ | |||
− | incorporate a Haskell model doing the heavy computation into a Cocoa |
||
− | application. |
||
+ | |||
− | This is rudimentary, and more work needs to be done, but I decided to put |
||
+ | Here, we develop a simple (Mac) Xcode project using Cocoa, the Interface |
||
− | this out before spending a lot of time on polishiing. The section "To do" |
||
+ | Builder (IB). The project follows the Model-View-Control design pattern |
||
− | lists things I can think of to add to this tutorial, some hard, some easy. |
||
+ | encouraged by Apple, with the View and Control entirely in Cocoa and IB, and |
||
+ | the Model in Haskell. |
||
+ | |||
+ | This is far from fulfilling the request found in the |
||
⚫ | |||
+ | But it is a simple process, not requiring |
||
+ | adding any Xcode plugins, or other extra applications. |
||
+ | |||
⚫ | |||
⚫ | |||
== Why? == |
== Why? == |
||
+ | Why would you want to do this? Those with Xcode/Cocoa experience will not |
||
+ | need an explanation. On the chance that someone else is browsing here, |
||
+ | I'll list a few things. |
||
+ | |||
+ | * Cocoa is not a language, it is a vast library of Objective-C objects. |
||
+ | |||
+ | * Cocoa covers tasks such as: |
||
+ | ** windowing |
||
+ | ** displaying tables, outlines, trees |
||
+ | ** text fields (with built in editing), and |
||
+ | ** on and on... |
||
+ | |||
+ | Together with Interface Builder, one can define most user interfaces with |
||
+ | simple drag and drop from a library of element, then connect them with your |
||
+ | code by dragging and drop in the IB screen. |
||
+ | |||
+ | You automatically get full integration with the Mac system. You get the |
||
+ | Mac Aqua look. |
||
+ | |||
+ | Enough said. What Cocoa doesn't provide are the tools for mathematical |
||
+ | modeling of an application domain that Haskell provides. Parsing comes |
||
+ | immediately to mind. |
||
+ | |||
+ | In the interest of full disclosure—I'm not an old time Mac person. I've |
||
+ | had my Mac for two years. I only decided to learn Objective-C and Cocoa |
||
+ | after I explored doing an application using Python and Qt, and someone in |
||
+ | the Python community said “Objective-C is easy. Why don't you write a real |
||
+ | Mac application”. Neither am I a Haskell expert. Although I've tinkered |
||
+ | with Haskell for a long time (and it is probably my favorite language), |
||
+ | I've just come back to it after a couple years away. |
||
+ | |||
== Overview == |
== Overview == |
||
== Compile Haskell module == |
== Compile Haskell module == |
||
Line 26: | Line 58: | ||
== Compile and run == |
== Compile and run == |
||
== To do == |
== To do == |
||
+ | |||
+ | <!-- wiki code generated by txt2tags 2.5 (http://txt2tags.sf.net) --> |
||
+ | <!-- cmdline: txt2tags -\-target wiki haskellFromXcode.t2t --> |
Revision as of 22:08, 17 October 2009
Since I'm new to this, I'm trying out the beginings of a tutorial here on my user page.
Xcode, Cocoa, and Haskell together
John Velman
Here, we develop a simple (Mac) Xcode project using Cocoa, the Interface Builder (IB). The project follows the Model-View-Control design pattern encouraged by Apple, with the View and Control entirely in Cocoa and IB, and the Model in Haskell.
This is far from fulfilling the request found in the Missing tutorials page. But it is a simple process, not requiring adding any Xcode plugins, or other extra applications.
It assumes you know something about Xcode, and something about Haskell. Its not an objective-c bridge.
Why?
Why would you want to do this? Those with Xcode/Cocoa experience will not need an explanation. On the chance that someone else is browsing here, I'll list a few things.
- Cocoa is not a language, it is a vast library of Objective-C objects.
- Cocoa covers tasks such as:
- windowing
- displaying tables, outlines, trees
- text fields (with built in editing), and
- on and on...
Together with Interface Builder, one can define most user interfaces with simple drag and drop from a library of element, then connect them with your code by dragging and drop in the IB screen.
You automatically get full integration with the Mac system. You get the Mac Aqua look.
Enough said. What Cocoa doesn't provide are the tools for mathematical modeling of an application domain that Haskell provides. Parsing comes immediately to mind.
In the interest of full disclosure—I'm not an old time Mac person. I've had my Mac for two years. I only decided to learn Objective-C and Cocoa after I explored doing an application using Python and Qt, and someone in the Python community said “Objective-C is easy. Why don't you write a real Mac application”. Neither am I a Haskell expert. Although I've tinkered with Haskell for a long time (and it is probably my favorite language), I've just come back to it after a couple years away.