Created by Ian Connolly / Slides available on GitHub
Hi, I'm Ian
I've been working on libraries for cloud computing in Haskell
Specifically I've been working on getting Cloud Haskell working on AWS
As well as trying to show why Haskell, public clouds, and Cloud Haskell are a great fit.
Haskell is a:
... programming language.
Purely functional means that functions have no side-effects in Haskell*
Lazy semantics mean functions are evaluated only to the extent required by a caller
Strongly and statically typed means a program's types are checked at compile-time with no coercion
quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
where
lesser = filter (< p) xs
greater = filter (>= p) xs
IO is fundamentally impure, how does it work in Haskell?
We represent impure actions as IO actions
We compose IO actions using an IO monad
Haskell runs the IO action called 'main' with special semantics
main :: IO ()
main = do
putStrLn "I get printed to stdout"
putStr "I'm a prompt: "
input <- getLine
putStr "\n"
putStrLn input
Cloud Haskell is a domain-specific language for developing programs for a distributed computing environment, shallowly embedded in Haskell, providing a message-passing communication model.
In short, trying to leverage the best of Haskell and Erlang
Cloud Haskell programs are made up of:
echoRemote :: () -> Backend -> Process ()
echoRemote () _backend = forever $ do
str <- expect
remoteSend (str :: String)
echoLocal :: LocalProcess ()
echoLocal = do
str <- liftIO $ putStr "# " >> hFlush stdout >> getLine
unless (null str) $ do
localSend str
liftIO $ putStr "Echo: " >> hFlush stdout
echo <- localExpect
liftIO $ putStrLn echo
echoLocal
Erlang/OTP is the most similar technology
Sizeable, mature industry deployments.
Has domain-specific features baked in (binary pattern-matching!)
Google's Go has a pragmatic take on channels and concurrency.
A Haskell library for managing the creation of 'Cloud Services'
Create a VM, find available cloud services, parse AWS output to be usable by Cloud Haskell.
Majority of the work was here, interfacing with AWS
A Haskell library, built on top of aws-service-api
Allows AWS to be a Cloud Haskell Service Provider
Majority of this was an adaption of the existing distributed-process-azure library to work on AWS
Two additions to the aws-service-api library over its azure cousin are createVM and shutdownVM
These automatically add and remove VMs from a Cloud Service
Bubbled up to distributed-process-aws they allow us to expose the following high-level API:
scaleUp :: CloudService -> Int -> CloudService
scaleDown :: CloudService -> Int -> CloudService
Two demos, Fibonacci and Echo
Echo is an expansion of the code you saw earlier
Fibonacci demonstrates the serialization of functions
Better AWS primitives
Specifically, find a way to expose instance types to higher level programs