[Haskell-beginners] small expression evaluator
Henk-Jan van Tuyl
hjgtuyl at chello.nl
Tue Mar 22 10:14:57 CET 2011
On Tue, 22 Mar 2011 08:56:45 +0100, Petr Novotnik
<pnovotnik at googlemail.com> wrote:
> data Person = Person {
> personName :: String
> , personAge :: Int
> }
> deriving (Show)
>
> exampleExpr :: Bool
> exampleExpr = (VConst 99) .==. (VFunc personAge) $ Person "pete" 99
>
>
> I was wondering, whether it'd be possible to enable defining expression
> without the Value data constructors, i.e.
>
>
> 99 .==. personAge $ Person "pete" 99
You can write:
99 == personAge (Person "pete" 99)
Regards,
Henk-Jan van Tuyl
--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
More information about the Beginners
mailing list