Find it here: https://github.com/bitemyapp/learnhaskell
| module Test | |
| import Provider | |
| import Database | |
| import Queries | |
| %language TypeProviders | |
| %link C "sqlite3api.o" |
| -- in reply to http://www.reddit.com/r/haskell/comments/21mja6/make_lllegal_state_transitions_unrepresentable/ | |
| -- | |
| -- We implement a tiny language with three commands: Open, Close, and Get. | |
| -- The first Get after an Open returns 1, the second Get returns 2, and so on. | |
| -- | |
| -- Get is only valid while the state is open, and | |
| -- Open must always be matched by a Close. | |
| -- We enforce both restrictions via the type system. | |
| -- | |
| -- There are two valid states: Opened and Closed. |
| // This systemd runs iptables-restore on boot: | |
| [Unit] | |
| Description=Packet Filtering Framework | |
| DefaultDependencies=no | |
| After=systemd-sysctl.service | |
| Before=sysinit.target | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules |
| This is a preview of Tom Ellis' database query library for Haskell. | |
| > {-# LANGUAGE Arrows, FlexibleContexts #-} | |
| > -- TODO: Get rid of FlexibleContexts if we ever move the definition of s | |
| > -- elsewhere. | |
| > {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} | |
| > {-# LANGUAGE TemplateHaskell #-} | |
| > | |
| > module Karamaan.Opaleye.Examples where | |
| > |
In response to this reddit post about failing to understand the Pipes library after a couple of hours. I wanted to show how an experienced haskeller does it, but I'm afraid it also took me quite a few hours, which is why the following list of steps goes on and on.
After all those hours, my opinion is that Pipes is not at all an easy library. I don't know if Conduit is any easier, but otherwise I side with your friend in advising to use something else (perhaps ordinary lazy IO?) instead of Pipes.
Anyway, here is the full brain dump of my steps as I tried to get your three snippets to fit together.
- Since you say that you have a hard time combining the snippets, I assume that they must have complicated types. So my first goal is to figure out the type of your first snippet.
- hoogle for
parseUrl,withManager, etc. No results. - Google for
haskell runEffect, find that it's a method fromPipes.Core,
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| module FizzBuzzC | |
| %default total | |
| -- Dependently typed FizzBuzz, constructively | |
| -- A number is fizzy if it is evenly divisible by 3 | |
| data Fizzy : Nat -> Type where | |
| ZeroFizzy : Fizzy 0 | |
| Fizz : Fizzy n -> Fizzy (3 + n) |
| http://www.jerf.org/iri/post/2908 | |
| http://mwotton.github.com/hs_gbu/ | |
| http://reddit.com/r/haskell/comments/y6i7d/do_we_have_real_world_examples_of_where_static/ | |
| http://reddit.com/r/haskell/comments/12e3a0/the_good_the_bad_and_the_ugly_haskell_in/ | |
| http://blog.codersbase.com/2010/09/composability-laziness-testing-and.html | |
| https://www.fpcomplete.com/user/imalsogreg/functional-programming-elevator-pitch | |
| http://evincarofautumn.blogspot.com/2012/07/so-i-write-compilers-for-living-now.html | |
| http://www.reddit.com/r/haskell/comments/2gz7s1/please_point_me_at_an_eloquent_paper_or_post_on/ |
| name: Pacific/Kiritimati , cc: KI , offset: 50400 (14 hours) , comments: Line Islands | |
| name: Pacific/Chatham , cc: NZ , offset: 49500 (13.75 hours) , comments: Chatham Islands | |
| name: Pacific/Fakaofo , cc: TK , offset: 46800 (13 hours) , comments: | |
| name: Antarctica/South_Pole , cc: AQ , offset: 46800 (13 hours) , comments: Amundsen-Scott Station, South Pole | |
| name: Antarctica/McMurdo , cc: AQ , offset: 46800 (13 hours) , comments: McMurdo Station, Ross Island | |
| name: Pacific/Tongatapu , cc: TO , offset: 46800 (13 hours) , comments: | |
| name: Pacific/Enderbury , cc: KI , offset: 46800 (13 hours) , comments: Phoenix Islands | |
| name: Pacific/Apia , cc: WS , offset: 46800 (13 hours) , comments: |