class Functor f => Applicative f where
 return :: a -> f a

instance Applicative [] where
 return a = [a]

instance Applicative Maybe where
 return a = Just a
switch (l->l_stat) {
case LSONPROC:
       break;

case LSRUN:
       if (l->l_swtime > outpri2) {
                outl2 = l;
                outpri2 = l->l_swtime;
       }
       break;
...
-- http://hackage.haskell.org/packages/archive/containers/
-- latest/doc/html/Data-Tree.html から抜粋
data Tree a = Node {
       rootLabel :: a,     -- ^ label value
       subForest :: Forest a -- ^ zero or more child trees
     }
type Forest a = [Tree a]

-- | The elements of a tree in pre-order.
flatten :: Tree a -> [a]
flatten t = squish t []
  where squish (Node x ts) xs = x:Prelude.foldr squish xs ts
$ sudo apt-get install haskell-platform
$ rehash
$ ghci
GHCi, version 7.0.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> fmap (foldr (++) "" . flip replicate "hoge") [1..3]
["hoge","hogehoge","hogehogehoge"]

$ irb
irb(main)> (1..3).collect{|a|s="";a.times{s+="hoge"};s}
=> ["hoge", "hogehoge", "hogehogehoge"]
$ sudo apt-get install cabal-install
$ rehash
$ cabal update
$ cabal install carettah
# がりがりっとコンパイルされる
$ ~/.cabal/bin/carettah
carettah version 0.0.4
$   sudo gem update
$   sudo gem install earchquake
#   月日は流れ、 、そしてある日、 、
$   sudo gem update
$ cabal update # ローカルの Hackage データベースを更新
$ cabal install yesod
# 後日yesodを最新版に更新しようと思いたつ
$ cabal upgrade
--snip--
The 'cabal upgrade' command has been removed
because people found it confusing and it often
led to broken packages.
--snip--
$ cabal install yesod
# yesodが動作しない or 依存関係をcabalが自動解決しない
# とりあえずcabalでインストールしたHackageを全部消そう
$ rm -rf ~/.ghc ~/.cabal
$ cabal update
$ cabal install yesod
$ cabal info yesod
--snip--
   Versions available: 0.6.7, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.8.2,
               0.8.2.1, 0.9.1, 0.9.1.1 (and 35 others)
--snip--
   Dependencies: yesod-core >=0.9.1.1 && <0.10,
            yesod-auth ==0.7.*, yesod-json ==0.2.*,
            yesod-persistent ==0.2.*, yesod-form ==0.3.*,
            monad-control ==0.2.*, ...
$ sudo apt-get install 
  haskell-debian-utils haskell-devscripts
$ wget http://hackage.haskell.org/packages/archive/
  hcwiid/0.0.1/hcwiid-0.0.1.tar.gz
$ tar xfz hcwiid-0.0.1.tar.gz
$ cd hcwiid-0.0.1/
$ cabal-debian --debianize --ghc 
  --maintainer="Kiwamu Okabe <kiwamu@debian.or.jp>"
$ ls debian
changelog compat control copyright rules
$ debuild -rfakeroot -us -uc
$ ls ../*hcwiid*deb
../libghc-hcwiid-dev_0.0.1-1~hackage1_amd64.deb
../libghc-hcwiid-doc_0.0.1-1~hackage1_all.deb
../libghc-hcwiid-prof_0.0.1-1~hackage1_amd64.deb
$ cat debian/rules
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/hlibrary.mk
$
後日談) JoachimからメールがあってDDやDMでなくても
pkg-haskellチームになれるそうです!
>> [Q2] Can the person as not DM (Debian Maintainer) join
>> pkg-haskell team? Or they should become DM, first?
> No need to be a DM, as there are DDs around that can do
> the sponsoring."
Package: wnpp
Severity: wishlist
Owner: Kiwamu Okabe <kiwamu@debian.or.jp>

* Package name : haskell-ansi-wl-pprint
 Version     : 0.6.3
 Upstream Author : Daan Leijen, Max Bolingbroke
<batterseapower@hotmail.com>
* URL         : http://github.com/batterseapower/ansi-wl-pprin
 Vcs-Browser     :
http://anonscm.debian.org/gitweb/?p=collab-maint/haskell-ans
* License      : BSD3
$ vi debian/control
Maintainer: Debian Haskell Group 
<pkg-haskell-maintainers@lists.alioth.debian.org>
Uploaders: Kiwamu Okabe <kiwamu@debian.or.jp>
Vcs-Darcs: 
http://darcs.debian.org/pkg-haskell/haskell-ansi-wl-pprint
Vcs-Browser: http://darcs.debian.org/cgi-bin/
darcsweb.cgi?r=pkg-haskell/haskell-ansi-wl-pprint
DM-Upload-Allowed: yes
haskell-ansi-wl-pprint (0.6.3-2) UNRELEASED; urgency=low

 * repo is moved to darcs.
 * change Vcs-* lines on debian/control.

-- Kiwamu Okabe <kiwamu@debian.or.jp> Wed, 12 Oct 2011

haskell-ansi-wl-pprint (0.6.3-1) UNRELEASED; urgency=low

 * Debianization generated by cabal-debian

-- Kiwamu Okabe <kiwamu@debian.or.jp> Wed, 05 Oct 2011
$ sudo apt-get install darcs
$ pwd
/home/kiwamu/deb/haskell-ansi-wl-pprint/debian
$ darcs init --darcs-2
$ darcs record -a -l -m "Initial Check-In"
Finished recording patch 'Initial Check-In'
$ darcs put kiwamu-guest@darcs.debian.org:/darcs
 /pkg-haskell/haskell-ansi-wl-pprint
Finished applying...
Put successful.
$ ssh kiwamu-guest@darcs.debian.org 
 /darcs/pkg-haskell/tools/add-hooks.sh 
 haskell-ansi-wl-pprint




pkg-haskell-commits@lists.alioth.debian.org
$ dch # エディタが起動される




$ darcs record -a
$ darcs push
Sending mail to pkg-haskell-commits@lists.alioth.debian.org..
http://pkg-haskell.alioth.debian.org/cgi-bin/pet.cgi
$ darcs get darcs.debian.org:/darcs/pkg-haskell/tools
$ tools/pkg-haskell-checkout haskell-ansi-wl-pprint
$ cd haskell-ansi-wl-pprint/
$ debuild -i -I
$ debrelease
$ debuild clean
$ cd debian/
$ darcs tag $(dpkg-parsechangelog -lchangelog |
 grep-dctrl -n -s Version .)
$ darcs push -a
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係

HaskellとDebianの辛くて甘い関係

  • 6.
    class Functor f=> Applicative f where return :: a -> f a instance Applicative [] where return a = [a] instance Applicative Maybe where return a = Just a
  • 7.
    switch (l->l_stat) { caseLSONPROC: break; case LSRUN: if (l->l_swtime > outpri2) { outl2 = l; outpri2 = l->l_swtime; } break; ...
  • 10.
    -- http://hackage.haskell.org/packages/archive/containers/ -- latest/doc/html/Data-Tree.htmlから抜粋 data Tree a = Node { rootLabel :: a, -- ^ label value subForest :: Forest a -- ^ zero or more child trees } type Forest a = [Tree a] -- | The elements of a tree in pre-order. flatten :: Tree a -> [a] flatten t = squish t [] where squish (Node x ts) xs = x:Prelude.foldr squish xs ts
  • 11.
    $ sudo apt-getinstall haskell-platform $ rehash $ ghci GHCi, version 7.0.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> fmap (foldr (++) "" . flip replicate "hoge") [1..3] ["hoge","hogehoge","hogehogehoge"] $ irb irb(main)> (1..3).collect{|a|s="";a.times{s+="hoge"};s} => ["hoge", "hogehoge", "hogehogehoge"]
  • 13.
    $ sudo apt-getinstall cabal-install $ rehash $ cabal update $ cabal install carettah # がりがりっとコンパイルされる $ ~/.cabal/bin/carettah carettah version 0.0.4
  • 14.
    $ sudo gem update $ sudo gem install earchquake # 月日は流れ、 、そしてある日、 、 $ sudo gem update
  • 15.
    $ cabal update# ローカルの Hackage データベースを更新 $ cabal install yesod # 後日yesodを最新版に更新しようと思いたつ $ cabal upgrade --snip-- The 'cabal upgrade' command has been removed because people found it confusing and it often led to broken packages. --snip--
  • 16.
    $ cabal installyesod # yesodが動作しない or 依存関係をcabalが自動解決しない # とりあえずcabalでインストールしたHackageを全部消そう $ rm -rf ~/.ghc ~/.cabal $ cabal update $ cabal install yesod
  • 19.
    $ cabal infoyesod --snip-- Versions available: 0.6.7, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.8.2, 0.8.2.1, 0.9.1, 0.9.1.1 (and 35 others) --snip-- Dependencies: yesod-core >=0.9.1.1 && <0.10, yesod-auth ==0.7.*, yesod-json ==0.2.*, yesod-persistent ==0.2.*, yesod-form ==0.3.*, monad-control ==0.2.*, ...
  • 30.
    $ sudo apt-getinstall haskell-debian-utils haskell-devscripts
  • 31.
    $ wget http://hackage.haskell.org/packages/archive/ hcwiid/0.0.1/hcwiid-0.0.1.tar.gz $ tar xfz hcwiid-0.0.1.tar.gz $ cd hcwiid-0.0.1/ $ cabal-debian --debianize --ghc --maintainer="Kiwamu Okabe <[email protected]>" $ ls debian changelog compat control copyright rules
  • 32.
    $ debuild -rfakeroot-us -uc $ ls ../*hcwiid*deb ../libghc-hcwiid-dev_0.0.1-1~hackage1_amd64.deb ../libghc-hcwiid-doc_0.0.1-1~hackage1_all.deb ../libghc-hcwiid-prof_0.0.1-1~hackage1_amd64.deb
  • 33.
    $ cat debian/rules #!/usr/bin/make-f include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/hlibrary.mk $
  • 37.
    後日談) JoachimからメールがあってDDやDMでなくても pkg-haskellチームになれるそうです! >> [Q2]Can the person as not DM (Debian Maintainer) join >> pkg-haskell team? Or they should become DM, first? > No need to be a DM, as there are DDs around that can do > the sponsoring."
  • 40.
    Package: wnpp Severity: wishlist Owner:Kiwamu Okabe <[email protected]> * Package name : haskell-ansi-wl-pprint Version : 0.6.3 Upstream Author : Daan Leijen, Max Bolingbroke <[email protected]> * URL : http://github.com/batterseapower/ansi-wl-pprin Vcs-Browser : http://anonscm.debian.org/gitweb/?p=collab-maint/haskell-ans * License : BSD3
  • 41.
    $ vi debian/control Maintainer:Debian Haskell Group <[email protected]> Uploaders: Kiwamu Okabe <[email protected]> Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-ansi-wl-pprint Vcs-Browser: http://darcs.debian.org/cgi-bin/ darcsweb.cgi?r=pkg-haskell/haskell-ansi-wl-pprint DM-Upload-Allowed: yes
  • 42.
    haskell-ansi-wl-pprint (0.6.3-2) UNRELEASED;urgency=low * repo is moved to darcs. * change Vcs-* lines on debian/control. -- Kiwamu Okabe <[email protected]> Wed, 12 Oct 2011 haskell-ansi-wl-pprint (0.6.3-1) UNRELEASED; urgency=low * Debianization generated by cabal-debian -- Kiwamu Okabe <[email protected]> Wed, 05 Oct 2011
  • 43.
    $ sudo apt-getinstall darcs $ pwd /home/kiwamu/deb/haskell-ansi-wl-pprint/debian $ darcs init --darcs-2 $ darcs record -a -l -m "Initial Check-In" Finished recording patch 'Initial Check-In' $ darcs put [email protected]:/darcs /pkg-haskell/haskell-ansi-wl-pprint Finished applying... Put successful.
  • 44.
    $ ssh [email protected] /darcs/pkg-haskell/tools/add-hooks.sh haskell-ansi-wl-pprint [email protected]
  • 45.
    $ dch #エディタが起動される $ darcs record -a $ darcs push Sending mail to [email protected]..
  • 46.
  • 48.
    $ darcs getdarcs.debian.org:/darcs/pkg-haskell/tools $ tools/pkg-haskell-checkout haskell-ansi-wl-pprint $ cd haskell-ansi-wl-pprint/ $ debuild -i -I $ debrelease $ debuild clean $ cd debian/ $ darcs tag $(dpkg-parsechangelog -lchangelog | grep-dctrl -n -s Version .) $ darcs push -a