Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brainstormed some ideas for a cleaner interface for both inline use, …
…and module importing
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# IDEAS for new interface | ||
|
||
# option 1 (implicit method name from haskell function) | ||
class MyClass | ||
include Hubris | ||
def_haskell(code) | ||
end | ||
|
||
# option 2 (explicit method name) | ||
class MyClass | ||
def_haskell(method_name,code) | ||
end | ||
|
||
# option 3 () | ||
class Module | ||
include Hubris | ||
end | ||
|
||
class MyClass | ||
inline_haskell "haskell function" | ||
end | ||
|
||
# option 4 (more humourous) | ||
class Module | ||
include Hubris | ||
end | ||
|
||
class MyClass | ||
hubris "haskell function" | ||
end | ||
|
||
#----------------------------------------- | ||
# include at the module or package level | ||
#========================================= | ||
# does importing as_class make sense? no, just include the module | ||
# when interpreting Haskell module names replace . with :: | ||
|
||
# importing std module as a ruby module/class | ||
hubris :package => "containers", :module => "Data.Map", :as => "Data::Map" | ||
|
||
# importing your own module (defaults to module) | ||
hubris :package => "mypackage", :module => "MyModule" [, :as => "MyModule"] | ||
|
||
# implicit package handling (haskell file in my directory) | ||
hubris :module => "haskell/shit/MyModule" | ||
|
||
# simpler to implement option, allows more flexibility in Ruby land | ||
module Hubris | ||
module Data | ||
module Map | ||
hubris :package => "containers", :module => "Data.Map" | ||
end | ||
end | ||
end |