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:  Web frameworks (Christopher Done)
   2. Re:  Web frameworks (Lyndon Maydwell)
   3. Re:  share a record type (David Place)
   4.  Bool -> a -> Maybe a, or something similar (Tacit Sawk)
   5. Re:  Bool -> a -> Maybe a, or something similar (Michael Xavier)
   6. Re:  Bool -> a -> Maybe a, or something similar
      (Felipe Almeida Lessa)
   7.  Make synonym for Main? (Christopher Howard)
   8. Re:  Make synonym for Main? (Michael Xavier)


----------------------------------------------------------------------

Message: 1
Date: Fri, 17 Jun 2011 16:55:57 +0200
From: Christopher Done <[email protected]>
Subject: Re: [Haskell-beginners] Web frameworks
To: Haisheng Wu <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

On 17 June 2011 16:49, Haisheng Wu <[email protected]> wrote:

> Actually I have one question that what's the reason it has 'special' (a
> better word?) style at programming CSS and JavaScripts?
> Seems like no other frameworks doing that? (Correct me if I am wrong)
>

You don't really need a framework to do CSS

https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Style.hs

<https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Style.hs>or
JavaScript

https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Script.hs

<https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Script.hs>in
a first-class Haskell DSL. The benefit is that you can manipulate both at a
kind of macro level, and benefit from Haskell's type system if you wish to
make your JavaScript or CSS type-safe.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110617/b529a287/attachment-0001.htm>

------------------------------

Message: 2
Date: Fri, 17 Jun 2011 23:08:48 +0800
From: Lyndon Maydwell <[email protected]>
Subject: Re: [Haskell-beginners] Web frameworks
To: [email protected]
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

I know that haml[1], sass[2] and CoffeeScript[3] that are used quite
commonly in the ruby community for generating html, css and javascript
respectively.

I believe Yesod's primary motivation for using 'special' templates is
the ability to make static guarantees about wether URLs, etc are
valid, but they also alleviate some code repetition.

I'd actually be very happy if Yesod supported the syntax from haml,
etc, as it would be one less syntax to learn (not that the options
offered take long to learn) and these languages are quite nice to
write in.

--

[1] http://haml-lang.com/
[2] http://sass-lang.com/
[3] http://jashkenas.github.com/coffee-script/

On Fri, Jun 17, 2011 at 10:55 PM, Christopher Done
<[email protected]> wrote:
> On 17 June 2011 16:49, Haisheng Wu <[email protected]> wrote:
>>
>> Actually I have one question that what's the reason it has 'special' (a
>> better word?) style at programming CSS and JavaScripts?
>> Seems like no other frameworks doing that? (Correct me if I am wrong)
>
> You don't really need a framework to do CSS
> https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Style.hs
> or JavaScript
> https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Script.hs
> in a first-class Haskell DSL. The benefit is that you can manipulate both at
> a kind of macro level, and benefit from Haskell's type system if you wish to
> make your JavaScript or CSS type-safe.
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>



------------------------------

Message: 3
Date: Fri, 17 Jun 2011 08:11:58 -0400
From: David Place <[email protected]>
Subject: Re: [Haskell-beginners] share a record type
To: "Kees Bleijenberg" <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii


On Jun 17, 2011, at 7:00 AM, Kees Bleijenberg wrote:

> How can I express the fact that all sudoku solvers use the same recordtype? 
> Can I make a type of the record structure {board:: Board.... } and use it in 
> the constructor function or can I incorperate the recordtype in the class or 
> ......?


This is a good use for the "newtype" declaration.  Define your SudokuRecord and 
then specialize it using newtype.

data SudokoRecord ...

newtype SudokuTwins = SudokuTwins SudokuRecord
newtype Sudoku9x9 = Sudoku9x9 SudokuRecord

instance SudokuClass SudokuTwins where
...


instance SudokuClass Sudoku9x9 where
...

____________________
David Place   
Owner, Panpipes Ho! LLC
http://panpipesho.com
[email protected]





------------------------------

Message: 4
Date: Sat, 18 Jun 2011 13:24:10 +1000
From: Tacit Sawk <[email protected]>
Subject: [Haskell-beginners] Bool -> a -> Maybe a, or something
        similar
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

|Hello!

I tried Hoogle, but it didn't seem to have what I was after. I'm looking 
for something like this:

 > maybeWhen :: Bool -> a -> Maybe a
 > maybeWhen cond =
 >   if cond
 >      then Just
 >      else const Nothing

Is there a builtin that has the above sort of behaviour? I suppose it 
can even be generalised:

 > maybeWhen :: (MonadPlus m) => Bool -> a -> m a
 > maybeWhen cond =
 >   if cond
 >      then return
 >      else const mzero

Tacit
|
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110618/9840efdf/attachment-0001.htm>

------------------------------

Message: 5
Date: Fri, 17 Jun 2011 20:37:22 -0700
From: Michael Xavier <[email protected]>
Subject: Re: [Haskell-beginners] Bool -> a -> Maybe a, or something
        similar
To: Tacit Sawk <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hayoo seems to me to do a better job at type signature searching. A ton of
libraries seem to define a toMaybe function for this:

http://hackage.haskell.org/packages/archive/utility-ht/latest/doc/html/Data-Maybe-HT.html#v:toMaybe

That isn't built in though.

On Fri, Jun 17, 2011 at 8:24 PM, Tacit Sawk <[email protected]> wrote:

> **
> Hello!
>
> I tried Hoogle, but it didn't seem to have what I was after. I'm looking
> for something like this:
>
> > maybeWhen :: Bool -> a -> Maybe a
> > maybeWhen cond =
> >   if cond
> >      then Just
> >      else const Nothing
>
> Is there a builtin that has the above sort of behaviour? I suppose it can
> even be generalised:
>
> > maybeWhen :: (MonadPlus m) => Bool -> a -> m a
> > maybeWhen cond =
> >   if cond
> >      then return
> >      else const mzero
>
> Tacit
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>


-- 
Michael Xavier
http://www.michaelxavier.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110617/861eeccc/attachment-0001.htm>

------------------------------

Message: 6
Date: Sat, 18 Jun 2011 00:58:33 -0300
From: Felipe Almeida Lessa <[email protected]>
Subject: Re: [Haskell-beginners] Bool -> a -> Maybe a, or something
        similar
To: Michael Xavier <[email protected]>
Cc: Neil Mitchell <[email protected]>, [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

On Sat, Jun 18, 2011 at 12:37 AM, Michael Xavier
<[email protected]> wrote:
> Hayoo seems to me to do a better job at type signature searching.

Hoogle usually does a great job with type signatures.  The problem
seems to be that by default it searches through just a small number of
packages, and AFAIK you can't tell it to search on all Hackage.  See
these three links:

http://haskell.org/hoogle/?hoogle=Bool+-%3E+a+-%3E+Maybe+a
http://haskell.org/hoogle/?hoogle=Bool+-%3E+a+-%3E+Maybe+a+++%2Butility-ht
http://haskell.org/hoogle/?hoogle=Bool+-%3E+a+-%3E+m+a+++%2Butility-ht

Cheers,

-- 
Felipe.



------------------------------

Message: 7
Date: Fri, 17 Jun 2011 21:47:20 -0800
From: Christopher Howard <[email protected]>
Subject: [Haskell-beginners] Make synonym for Main?
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Say you have a function in Main that is the same name as a function
you've imported, but you don't want to rename it. But then you have to
prefix it with "Main" each time you use it:

Main.functionName

Is there some way to rename Main or make a synonym for it, kind of like
the "import qualified" trick, so you could do...

M.functionName

-- 
frigidcode.com
theologia.indicium.us



------------------------------

Message: 8
Date: Sat, 18 Jun 2011 00:43:49 -0700
From: Michael Xavier <[email protected]>
Subject: Re: [Haskell-beginners] Make synonym for Main?
To: Christopher Howard <[email protected]>
Cc: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

http://www.haskell.org/haskellwiki/Import

You would do:
import qualified Main as M

On Fri, Jun 17, 2011 at 10:47 PM, Christopher Howard <
[email protected]> wrote:

> Say you have a function in Main that is the same name as a function
> you've imported, but you don't want to rename it. But then you have to
> prefix it with "Main" each time you use it:
>
> Main.functionName
>
> Is there some way to rename Main or make a synonym for it, kind of like
> the "import qualified" trick, so you could do...
>
> M.functionName
>
> --
> frigidcode.com
> theologia.indicium.us
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Michael Xavier
http://www.michaelxavier.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20110618/c096cc8a/attachment.htm>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 36, Issue 46
*****************************************

Reply via email to