Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Haskell Platform: Troubleshooting package configuration
errors? (Peter Jones)
2. Re: System administration using Haskell (Dominic Espinosa)
3. Re: Haskell Platform: Troubleshooting package configuration
errors? (egarrulo)
4. Re: System administration using Haskell (John Wiegley)
5. Reform and blaze: trouble with example code (Adrian May)
----------------------------------------------------------------------
Message: 1
Date: Fri, 14 Jun 2013 15:30:16 -0600
From: Peter Jones <[email protected]>
Subject: Re: [Haskell-beginners] Haskell Platform: Troubleshooting
package configuration errors?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain
egarrulo <[email protected]> writes:
> Error:
> Configuring the network-2.4.1.2 package failed
> make: *** [build.stamp] Error 2
I'm not familiar which system-level dependencies you need to have
installed via apt-get before you can build the network package but it
might help to install all of the build depends for the Debian GHC
package:
apt-get build-dep ghc6
I've built GHC 7.6.3 on squeeze successfully and I only remember having
to run that apt-get command plus maybe a few more for the OpenGL -dev
packages.
--
Peter Jones --- Love to Develop
Devalot: http://www.devalot.com
------------------------------
Message: 2
Date: Fri, 14 Jun 2013 14:54:56 -0700
From: Dominic Espinosa <[email protected]>
Subject: Re: [Haskell-beginners] System administration using Haskell
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hello Kevin,
In conjunction with general haskell tutorials, you might be interested in
the following libraries on hackage:
* shelly - convenience functions for systems programming
* hsshellscript - similar
* system-filepath - high-level interface for manipulating directories
* shqq - run shell commands using quasi-quoting, like perl's backtick
operator
* process - spawn external commands (supplying command name, arguments,
environment variables, etc
These are mostly under category 'System' on hackage, here:
http://hackage.haskell.org/packages/archive/pkg-list.html#cat:system
There are many other libraries that facilitate interacting with the OS
(especially if the OS is Unix), if you browse around hackage. Additionally,
the System.Posix.* modules provide direct bindings to POSIX services (fork,
nice, setenv, semaphores, shared memory, and so on), if that's what you
need.
StackOverflow is pretty good for finding example code for "how do I do
X in Haskell", so by all means search there as well.
I've found that writing "shell scripts" or small unix tools in Haskell is a
bit slower at first than writing them in, say, perl, but the payoff in 1)
avoiding bugs and 2) maintainability is gigantic. Give it a try -- you may
be impressed. These days I turn to haskell for all but the smallest of
scripts.
Good luck on your quest.
On Fri, Jun 14, 2013 at 05:29:08PM +0000, Kelleher, Kevin wrote:
> After more than two decades using the C-family of languages
> (C, C++, Java, C#, Perl, unix shells), I've been trying to learn
> Haskell. Each time I've begun with enthusiasm, and eventually
> run out of gas before I've gotten to writing real code. Haskell's
> learning curve is not very steep, but it is very long.
> I haven't yet gotten to the things I do the most, which all
> involve side-effects: mostly actions on directories and files,
> as well as calls to system utilities or other pieces of software.
>
> I'm working my way through "Real Life Haskell" and watching
> Erick Meijer's lectures, but I'm beginning to fear I'll run
> out of gas again if I can't write some programs that touch
> the real world.
>
> Are there any tutorials or other material that will get me
> going in that area?
>
> thanks,
>
> Kevin
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this message
> immediately if this is an electronic communication.
>
> Thank you.
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 3
Date: Sat, 15 Jun 2013 00:09:21 +0200
From: egarrulo <[email protected]>
Subject: Re: [Haskell-beginners] Haskell Platform: Troubleshooting
package configuration errors?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 14/06/13 23:30, Peter Jones wrote:
> egarrulo <[email protected]> writes:
>> Error:
>> Configuring the network-2.4.1.2 package failed
>> make: *** [build.stamp] Error 2
>
> I'm not familiar which system-level dependencies you need to have
> installed via apt-get before you can build the network package but it
> might help to install all of the build depends for the Debian GHC
> package:
>
> apt-get build-dep ghc6
>
> I've built GHC 7.6.3 on squeeze successfully and I only remember having
> to run that apt-get command plus maybe a few more for the OpenGL -dev
> packages.
>
Thank you, Peter, but that didn't solve the issue.
Meanwhile I've discovered that I was wrong and there is an automatic way
to install "cabal":
http://www.haskell.org/cabal/download.html
However, building it with the included "bootstrap.sh" fails with:
------------
Linking Setup ...
Configuring Cabal-1.14.0...
Setup: At least the following dependencies are missing:
base >=4 && <3 && >=2 && <5, unix >=2.0 && <2.6
Error during cabal-install bootstrap:
Configuring the Cabal package failed
------------
Still, according to cabal's homepage, "bootstrap.sh" should manage
dependencies:
Quote: "To make the process easier the cabal-install tarball contains a
bootstrap.sh script which downloads and installs all the dependencies."
Shouldn't it?
Thanks for your attention.
------------------------------
Message: 4
Date: Sat, 15 Jun 2013 02:36:23 -0500
From: "John Wiegley" <[email protected]>
Subject: Re: [Haskell-beginners] System administration using Haskell
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain
>>>>> Dominic Espinosa <[email protected]> writes:
> * shelly - convenience functions for systems programming
> * system-filepath - high-level interface for manipulating directories
As someone who writes system scripts using Haskell (instead of what I used to
use, Python), I can highly recommend these two with the addition of
system-fileio.
--
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com johnw on #haskell/irc.freenode.net
------------------------------
Message: 5
Date: Sat, 15 Jun 2013 17:19:20 +0800
From: Adrian May <[email protected]>
Subject: [Haskell-beginners] Reform and blaze: trouble with example
code
To: "[email protected]" <[email protected]>
Cc: Jasper Van der Jeugt <[email protected]>
Message-ID:
<cad-ubzfvrd7+ci3qc-5vg4fattq+e_1xhooeurnvs6v3xjm...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi All,
I'm trying to get this example working:
http://patch-tag.com/r/stepcut/reform/snapshot/current/content/pretty/examples/BlazeMain.hs
It emitted what I took to be bitrot about ToHtml having apparently been
generallised to ToMarkup and similar stuff, so I banged it into this form:
{-# LANGUAGE FlexibleContexts, FlexibleInstances, TypeFamilies,
OverloadedStrings #-}
module Main where
import Control.Applicative.Indexed
import Control.Monad
import qualified Data.ByteString.Char8 as C
* import Text.Blaze *
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Renderer.Utf8 (renderHtml)
import Text.Reform
* --import Text.Reform.Blaze.Common*
* --import Text.Reform.Blaze.Text*
* import Text.Reform.Blaze.String*
import Text.Reform.Happstack
import Happstack.Server
import SharedForm
instance *ToMarkup* (DemoFormError [Input]) where
*toMarkup* InvalidEmail = "Email address must contain a @."
*toMarkup* InvalidUsername = "Username must not be blank."
*toMarkup* (CommonError (InputMissing fid)) = H.toHtml $ "Internal
Error. Input missing: " ++ show fid
*toMarkup* (CommonError (NoStringFound input)) = H.toHtml $ "Internal
Error. Could not extract a String from: " ++ show input
*toMarkup* (CommonError (MultiStringsFound input)) = H.toHtml $ "Internal
Error. Found more than one String in: " ++ show input
usernameForm :: (Monad m, FormInput input, *ToMarkup* (DemoFormError
input)) =>
String
-> Form m input (DemoFormError input) *Markup* NotNull Username
usernameForm initialValue =
( *label "username: " ++>* (Username <<$>> inputText initialValue `prove`
(notNullProof InvalidUsername)))
{-
usernameForm :: (Monad m, FormInput input, ToMarkup (DemoFormError
input)) =>
String
-> Form m input (DemoFormError input) Markup NotNull Username
usernameForm initialValue =
errorList ++> (*label "username: " ++> *(Username <<$>> inputText
initialValue `prove` (notNullProof InvalidUsername)))
-}
blazeResponse :: *Markup* -> Response
blazeResponse html = toResponseBS (C.pack "text/html;charset=UTF-8") $
renderHtml html
blazeForm :: *Markup* -> *Markup*
blazeForm html =
H.form ! A.action "/"
! A.method "POST"
! A.enctype "multipart/form-data" $
do html
H.input ! A.type_ "submit"
formHandler :: (*ToMarkup* error, Show a) => Form (ServerPartT IO)
[Input] error *Markup* proof a -> ServerPart Response
formHandler form =
msum [ do method GET
html <- viewForm "user" form
ok $ blazeResponse $ blazeForm html
, do method POST
r <- eitherForm environment "user" form
case r of
(Right a) -> ok $ toResponse $ show a
(Left view) ->
ok $ blazeResponse $ blazeForm view
]
main :: IO ()
main =
do let form = usernameForm ""
simpleHTTP nullConf $ do decodeBody (defaultBodyPolicy "/tmp" 0 10000
10000)
formHandler form
where *italics* indicate the bits I changed, but now I'm stumped by the *
bold* bit barfing with:
Taser.hs:30:13:
Ambiguous type variable `children0' in the constraints:
(Data.String.IsString children0)
arising from the literal `"username: "' at Taser.hs:30:13-24
(ToMarkup children0)
arising from a use of `label' at Taser.hs:30:7-11
Probable fix: add a type signature that fixes these type variable(s)
In the first argument of `label', namely `"username: "'
In the first argument of `(++>)', namely `label "username: "'
In the expression:
(label "username: "
++>
(Username
<<$>>
inputText initialValue `prove` (notNullProof InvalidUsername)))
If I take out label "username: " ++>, then it all works fine, except I
don't have a label. I also tried putting the label inside the Username
constructor with the same result.
I have the following versions installed:
* blaze-markup (library)
Versions installed: 0.5.1.5
* blaze-html (library)
Versions installed: 0.6.1.1
* reform (library)
Versions installed: 0.1.2
* reform-blaze (library)
Versions installed: 0.1.2
The Glorious Glasgow Haskell Compilation System, version 7.4.2
Perhaps the markup thing is what broke it, but I can't see ToHtml in any of
those modules.
Thanks in advance,
Adrian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130615/1d20e043/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 60, Issue 24
*****************************************