<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lang.haskell.cafe">
    <title>gmane.comp.lang.haskell.cafe</title>
    <link>http://blog.gmane.org/gmane.comp.lang.haskell.cafe</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105372"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105368"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105363"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105362"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105361"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105360"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105358"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105348"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105344"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105341"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105334"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105332"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105331"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105325"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105321"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105308"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105301"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105278"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105277"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105275"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105372">
    <title>Failure deriving MonadRWS when using a type-family for the State part</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105372</link>
    <description>&lt;pre&gt;All,

The following code results in a compilation error (I tried GHC 7.4.1 &amp;amp; a
7.7.20130430 build):

{-# LANGUAGE TypeFamilies,
             GeneralizedNewtypeDeriving,
             StandaloneDeriving #-}

module Main where

import Control.Applicative
import Control.Monad.RWS

data C = C
data E = E

data S1 = S1 Int

type family I a :: *
type instance I S1 = Int

newtype T a s m r = T { unT :: RWST C [E] (I s) m r }
  deriving ( Functor
           , Applicative
           , Monad
           , MonadReader C
           , MonadWriter [E]
           , MonadState (I s)
           , MonadRWS C [E] (I s)
           , MonadTrans
           )

Error:

    No instance for (MonadState (I s) (T a s m))
      arising from the 'deriving' clause of a data type declaration
    Possible fix:
      use a standalone 'deriving instance' declaration,
        so you can specify the instance context yourself
    When deriving the instance for (MonadRWS C [E] (I s) (T a s m))

Commenting out the MonadRWS line from the derivings list (i.e. the line
pointed at by the error) works as expected. I was somehow unable to get
a suitable standalone-deriving clause working, so didn't test that.

Is this expected?

Regards,

Nicolas
&lt;/pre&gt;</description>
    <dc:creator>Nicolas Trangez</dc:creator>
    <dc:date>2013-05-20T22:08:08</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105368">
    <title>Stuck on design problem</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105368</link>
    <description>&lt;pre&gt;All,

Since I'm stuck on a coding problem and can't figure out how to proceed,
I decided to call for help.

I'm unable to get some code to typecheck, so maybe I'm missing something
obvious on the implementation side, or more likely the design is
completely wrong.

Here's the idea: I have some code which uses some log of "Entry a"
values (for some polymorphic type 'a'), and provides actions which
output "Command a" values which should be interpreted by some wrapper
code, e.g. adding some new entries to the log. These actions are
implemented in a custom WriterT transformer (in this demo code, the
original is more complex) to output Commands, while the inner monad
should give access to the log entries (this could be in-memory like in
the example, or stored on disk so using IO).

You can find a trimmed-down version at
https://gist.github.com/NicolasT/4230251f4f87f110d197

This doesn't type-check, and I'm not sure how to proceed. Am I taking a
wrong approach? Do I need a different design?

Thanks,

Nicolas
&lt;/pre&gt;</description>
    <dc:creator>Nicolas Trangez</dc:creator>
    <dc:date>2013-05-20T11:25:21</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105363">
    <title>New Functional Programming Job Opportunities</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105363</link>
    <description>&lt;pre&gt;Here are some functional programming job opportunities that were posted
recently:

Test Engineer at Klarna
http://functionaljobs.com/jobs/146-test-engineer-at-klarna

Cheers,
Sean Murphy
FunctionalJobs.com
&lt;/pre&gt;</description>
    <dc:creator>Functional Jobs</dc:creator>
    <dc:date>2013-05-20T06:00:02</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105362">
    <title>rip in the class-abstraction continuum</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105362</link>
    <description>&lt;pre&gt;Hi. I won't pretend to be an advanced Haskell programmer. However, I
have a strong interest in abstraction, and I have been playing around
with programming as abstractly as possible. Naturally, I find classes to
be quite attractive and useful.

However, something is bothering me. Lately I keep running into this
situation where I have to cut across abstraction layers in order to make
the code work. More specifically, I keep finding that I have to add
constraints to a class definition, because eventually I find some
instance of that class which needs those constraints to compile.

For example, I wanted to create a class which represents all things that
can be converted into X,Y coordinates. Naturally, I would like to do
something like this:

code:
--------
class XyConv a where

  toXy :: a b -&amp;gt; [Xy b]
--------

This leaves me free in the future to use any number type conceivable in
the Xy coordinates - Floating or Integral types, or whatever. (Doesn't
even have to be numbers, actually!)

However the first instance I create, requires me to use operators in the
function definition which require at least a Floating type. (The error
will say Fractional, but there are other components that also require
Floating.)

code:
--------
data CircAppr a b = CircAppr a b b -- number of points, rotation angle,
radius
    deriving (Show)

instance Integral a =&amp;gt; XyConv (CircAppr a) where

  toXy (CircAppr divns ang rad) =
      let dAng = 2 * pi / (fromIntegral divns) in
      let angles = map ((+ ang) . (* dAng) . fromIntegral) [0..divns] in
      map (\a -&amp;gt; am2xy a rad) angles
--------

This gives me the error

code:
--------
    Could not deduce (Fractional b) arising from a use of `/'
    from the context (Integral a)
      bound by the instance declaration
      at /scratch/cmhoward/pulse-spin/pulse-spin.hs:51:10-42
    Possible fix:
      add (Fractional b) to the context of
        the type signature for toXy :: CircAppr a b -&amp;gt; [Xy b]
        or the instance declaration
    In the expression: 2 * pi / (fromIntegral divns)
    In an equation for `dAng': dAng = 2 * pi / (fromIntegral divns)
    In the expression:
      let dAng = 2 * pi / (fromIntegral divns) in
      let angles = map ((+ ang) . (* dAng) . fromIntegral) [0 .. divns]
      in map (\ a -&amp;gt; am2xy a rad) angles
--------

I can get a quick fix by adding Floating to the context of the /class/
definition:

code:
--------
class XyConv a where

  toXy :: Floating b =&amp;gt; a b -&amp;gt; [Xy b]
--------

But what I really want is to put Floating in the context of the
/instance/ declaration. But I don't know how to do that syntactically.

&lt;/pre&gt;</description>
    <dc:creator>Christopher Howard</dc:creator>
    <dc:date>2013-05-20T05:16:38</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105361">
    <title>ANN: lambdabot-4.3</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105361</link>
    <description>&lt;pre&gt;As discussed a couple months ago, I have assumed maintainership of Lambdabot and a a new release has been brewing for a while.  It has now been Hackaged as lambdabot-4.3.  

There are quite a few changes in this release, mainly internal.  Plugins written for older versions will require some fairly straightforward rewriting - the plugin interface is now based on a record rather than a type class, and makes use of some simple monad transformers to stabilize the API a bit in the face of future changes.  There are many things I'd like to do to continue modernizing it, the most significant of which being that I'd like to overhaul the state storage system and break it down into smaller packages.

Therefore, plugin-writers should consider this a bit of a stepping-stone release - in the not too distant future, another release will probably break the plugin API again.  If you have open-source plugins, please let me know and I'll feed you patches to keep up with any changes coming down the pipeline.

The most significant changes from the user's perspective are probably the expanded command line interface (try --help) and the changes to the eval plugin.  Eval now uses Safe Haskell, and accepts a much wider array of user-supplied code - the "&amp;lt; at &amp;gt;let" command now accepts module imports, type declarations, class declarations, and instances, and will add clauses to existing function definitions when applicable.

I apologize in advance that the documentation is still mostly in a state of non-existence.  If anyone runs into issues, please report them to me.  I can be reached through the following channels:

- github "issues"[1]
- e-mail, at this address
- #haskell (I'm "mokus" there) - I'm not often present, but pretty much always connected and will see and eventually respond to PRIVMSGs.

[1] https://github.com/mokus0/lambdabot/issues
&lt;/pre&gt;</description>
    <dc:creator>James Cook</dc:creator>
    <dc:date>2013-05-19T22:41:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105360">
    <title>More general "pattern matching"</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105360</link>
    <description>&lt;pre&gt;Suppose I have a Category C


which has "products" in the sense that there exists a "factors" function
with suitable properties


Then I can define this interesting combinator


which allows some form of "pattern matching", for example


and even


Does anyone have anything to say about this?  I'm sure others must have come
across it before.  There's something very lensy going on here too.  There's
nothing special about 'Category's here, but it's an example where the
structure is demonstrated nicely.

It's a shame that the structure of the pattern must be duplicated on the
left and right of the binding.

Tom
&lt;/pre&gt;</description>
    <dc:creator>Tom Ellis</dc:creator>
    <dc:date>2013-05-19T22:09:15</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105358">
    <title>DSL to English and back for game rule set?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105358</link>
    <description>&lt;pre&gt;Hello all,

I recognize this isn't directly a Haskell-related question, but as I'd like
to solve this problem in Haskell &amp;amp; figured it's applicable. Let me know if
there's a better place to ask.

I am interested in creating a DSL (or set of types) for describing rules
for a computer game. I'd like the language to be able to be written out to
readable and clear English. I'd also like to be able to recreate the
representation by reading the English back in. The idea is that the DSL
will be unambiguous in either English or its internal representation. My
thinking is that this will avoid inconsistencies between the game rules and
the text describing those rules to the players.

I want the ruleset to be able to describe type of heroes and monsters,
their abilities, the effects of their attacks, how they use resources, etc.

I realize this may not be an efficient way to go about writing a game, but
it seems like an interesting project. Some of my concerns are at what level
the DSL should be written to allow for extensions for new heroes, monsters,
etc. without having to just add very specific extensions every time a new
hero or item is created.

Does anyone have thoughts on how to proceed on this, previous work, and/or
ways to investigate it?

Thanks,
Matthew
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>Matthew O'Connor</dc:creator>
    <dc:date>2013-05-19T20:27:33</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105348">
    <title>Non-deterministic behaviour of aeson's parser</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105348</link>
    <description>&lt;pre&gt;I am observing a non-deterministic behaviour of aeson's parser.

I'm writing here in addition to filing a bug report [1] to draw
attention to this (pretty scary) problem.

To try to reproduce this problem, do this:

  git clone https://gist.github.com/5604887.git aeson
  cd aeson
  ghc aeson.hs
  ./aeson | sort | uniq -c

This is my result:

    32 Left "key \"module\" not present"
    55 Left "When parsing the record SymValue of type Main.SymValueInfo the key fixity was not present."
  1913 Right ()

Can others reproduce this in their environments?

Does anyone have ideas about where the bug may lie?
Many aeson's dependencies do unsafe IO stuff that could lead to
such consequences.

Roman

[1]: https://github.com/bos/aeson/issues/125
&lt;/pre&gt;</description>
    <dc:creator>Roman Cheplyaka</dc:creator>
    <dc:date>2013-05-18T16:25:32</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105344">
    <title>Compiler error in Parsec using ByteString</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105344</link>
    <description>&lt;pre&gt;Hello all,
I am trying to write a small calculator using Parsec. Every thing went fine
and I wrote this [1] and now I am trying to use ByteString to make it more
faster but getting compiler error which I am not able to figure out. Could
some one please tell me what is wrong with this code. In case of
indentation error, code on hpaste[2]

{-# LANGUAGE OverloadedStrings #-}
import qualified Text.Parsec.Token as Token
import Text.Parsec.Prim
import Text.Parsec.Char
import Text.Parsec.Expr
import Text.Parsec.Combinator
import Text.Parsec.Language
import qualified Text.Parsec.ByteString.Lazy as T
import qualified Data.ByteString.Lazy.Char8 as BS
import Control.Applicative hiding ( ( &amp;lt;|&amp;gt; ) , many )
import Data.Maybe ( fromJust )

languageDef = emptyDef { Token.commentStart   = "/*"
               , Token.commentEnd     = "*/"
               , Token.commentLine    = "//"
               , Token.nestedComments = False
               , Token.identStart     = letter &amp;lt;|&amp;gt; char '_'
               , Token.identLetter    = alphaNum &amp;lt;|&amp;gt; oneOf "_'"
               , Token.opStart        = Token.opLetter emptyDef
               , Token.opLetter       = oneOf ":!#$%&amp;amp;*+./&amp;lt;=&amp;gt;?&amp;lt; at &amp;gt;\\^|-~"
               , Token.reservedOpNames= ["*" , "/" , "^" , "+" , "-" ]
               , Token.reservedNames  = []
               , Token.caseSensitive  = True
               }

lexer = Token.makeTokenParser languageDef

identifier = Token.identifier lexer
reserved = Token.reserved lexer
operator = Token.operator lexer
reservedOp = Token.reservedOp lexer
natural = Token.natural lexer
integer = Token.integer lexer
float = Token.float lexer
lexeme = Token.lexeme lexer
parens = Token.parens lexer
whiteSpace = Token.whiteSpace lexer
semi = Token.semi lexer
comma = Token.comma lexer
colon = Token.colon lexer
dot = Token.dot lexer
semiSep = Token.semiSep lexer
commaSep = Token.commaSep lexer



data Expr = Num Integer
          | Add Expr Expr
          | Sub Expr Expr
          | Mul Expr Expr
          | Div Expr Expr
          | Exp Expr Expr
          deriving Show

exprCal    :: T.Parser Expr
exprCal    = buildExpressionParser table factor


table   = [ [ op "^"  Exp AssocRight ]
          , [ op "*"  Mul AssocLeft, op "/"  Div AssocLeft ]
          , [ op "+"  Add AssocLeft, op "-"  Sub AssocLeft ]
          ]
        where
          op s f assoc  = Infix ( reservedOp s  &amp;gt;&amp;gt; return f ) assoc

factor :: T.Parser Expr
factor  = parens  exprCal
        &amp;lt;|&amp;gt; Num &amp;lt;$&amp;gt; integer



calExpression  :: Expr -&amp;gt; Integer
calExpression ( Num n ) = n
calExpression ( Add e1 e2 ) = calExpression e1 + calExpression e2
calExpression ( Sub e1 e2 ) = calExpression e1 - calExpression e2
calExpression ( Mul e1 e2 ) = calExpression e1 * calExpression e2
calExpression ( Div e1 e2 ) = div ( calExpression e1 ) ( calExpression e2 )
calExpression ( Exp e1 e2 ) =   calExpression e1  ^ ( calExpression e2 )


calculator :: String -&amp;gt; Integer
calculator expr = case parse ( whiteSpace &amp;gt;&amp;gt; exprCal ) ""  ( BS.pack expr )
of
                       Left msg -&amp;gt; error "failed to parse"
                       Right ( val ) -&amp;gt; calExpression val


*Main&amp;gt; :load
"/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs"
[1 of 1] Compiling Main             (
/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs,
interpreted )

/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs:56:36:
    Couldn't match type `[Char]' with `BS.ByteString'
    Expected type: OperatorTable
                     BS.ByteString () Data.Functor.Identity.Identity Expr
      Actual type: [[Operator
                       String () Data.Functor.Identity.Identity Expr]]
    In the first argument of `buildExpressionParser', namely `table'
    In the expression: buildExpressionParser table factor
    In an equation for `exprCal':
        exprCal = buildExpressionParser table factor

/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs:67:11:
    Couldn't match type `[Char]' with `BS.ByteString'
    Expected type: ParsecT
                     BS.ByteString () Data.Functor.Identity.Identity Expr
      Actual type: ParsecT
                     String () Data.Functor.Identity.Identity Expr
    In the return type of a call of `parens'
    In the first argument of `(&amp;lt;|&amp;gt;)', namely `parens exprCal'
    In the expression: parens exprCal &amp;lt;|&amp;gt; Num &amp;lt;$&amp;gt; integer

/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs:67:19:
    Couldn't match type `BS.ByteString' with `[Char]'
    Expected type: ParsecT
                     String () Data.Functor.Identity.Identity Expr
      Actual type: T.Parser Expr
    In the first argument of `parens', namely `exprCal'
    In the first argument of `(&amp;lt;|&amp;gt;)', namely `parens exprCal'
    In the expression: parens exprCal &amp;lt;|&amp;gt; Num &amp;lt;$&amp;gt; integer

/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs:68:21:
    Couldn't match type `[Char]' with `BS.ByteString'
    Expected type: ParsecT
                     BS.ByteString () Data.Functor.Identity.Identity Integer
      Actual type: ParsecT
                     String () Data.Functor.Identity.Identity Integer
    In the second argument of `(&amp;lt;$&amp;gt;)', namely `integer'
    In the second argument of `(&amp;lt;|&amp;gt;)', namely `Num &amp;lt;$&amp;gt; integer'
    In the expression: parens exprCal &amp;lt;|&amp;gt; Num &amp;lt;$&amp;gt; integer

/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs:82:46:
    Couldn't match type `BS.ByteString' with `[Char]'
    Expected type: ParsecT
                     String () Data.Functor.Identity.Identity Expr
      Actual type: T.Parser Expr
    In the second argument of `(&amp;gt;&amp;gt;)', namely `exprCal'
    In the first argument of `parse', namely `(whiteSpace &amp;gt;&amp;gt; exprCal)'
    In the expression: parse (whiteSpace &amp;gt;&amp;gt; exprCal) "" (BS.pack expr)

/Users/mukeshtiwari/Programming/Code/Compilers/ParsecExample.hs:82:62:
    Couldn't match type `BS.ByteString' with `[Char]'
    Expected type: String
      Actual type: BS.ByteString
    In the return type of a call of `BS.pack'
    In the third argument of `parse', namely `(BS.pack expr)'
    In the expression: parse (whiteSpace &amp;gt;&amp;gt; exprCal) "" (BS.pack expr)
Failed, modules loaded: none.
Prelude&amp;gt;


Mukesh Tiwari

[1] http://hpaste.org/88155
[2] http://hpaste.org/88156
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>mukesh tiwari</dc:creator>
    <dc:date>2013-05-18T11:07:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105341">
    <title>Extensible Records using Implicit Parameters</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105341</link>
    <description>&lt;pre&gt;Hello,

Records in Haskell are somewhat of a contentious issue and many
proposals have been put forth to address the shortcomings of the current
record system [1].  Below, I introduce a small library relying on
several GHC extensions, crucially Implicit Parameters and Constraint
Kinds, which implements an extensible record system.  While by no means
production-ready, it is remarkably close to how I think an extensible
record system should function.

Record access is very convenient (reminiscent of Pascal's with
statement), while record update is somewhat cumbersome (but could
potentially be improved using Template Haskell).

Two caveats:

* Type inference for records does not work, so type signatures have to
  be provided.

* When more than one binding for an implicit parameter is in scope, it
  is not always clear which one takes precedence.  However, I think it
  is safe to assume that if the innermost binding is a let/where
  binding, it will carry the day.  In all other cases, it is probably
  safest to rely on explicit type signatures to resolve the ambiguity.


The record type is simply the dictionary type, which is more commonly
used to reify type class dictionaries.  Here, we use it to record a
number of implicit parameter bindings, i.e. if implicit parameters of
types `fields' are in scope, then the data constructor `Rec' will create
a dictionary from them, provided an appropriate type signature is given.


The `?' operator will bring the implicit parameter bindings previously
captured by `Rec' into scope.


This is the complete library.  Examples follow below.
========================================================================


Type synonyms to replace the awkward syntax for implicit parameter
constraints.



As a first example, construct a record with fields ?x and ?y, both of
type Int.


To access the fields of the record, we can use the `?' operator.
Expressions involving any of the fields can appear to the right of the
operator.
* xy ? ?x ==&amp;gt; 1
* xy ? ?x + ?y ==&amp;gt; 3


The next example illustrates record update


* xy' ? ?y ==&amp;gt; -2


Type signatures are required, but can be placed directly after `Rec'.



Record Restriction



We can combine records as follows, but the result may be implementation-
dependent if both records share fields.


* xyz ? ?x ==&amp;gt; -1


So it is probably better to disambiguate.


* xyz' ? ?x ==&amp;gt; -1

========================================================================

As an application, we use records to build a rudimentary object system.

A class is a record which can access its own fields, which are supplied
as an argument.


Originally I tried the type 'fields =&amp;gt; Record fields', which leads to
problems when tying the knot.

Given a class, we can get a record for property and method access by
using a fixed point combinator.



Type signatures for our next example.



This is an abstract class that computes the factorial of its abstract
property `?n'.  Notice how `?n' is not included in the function's return
type.


It is important that `r' only be opened inside the definitions of the
methods, otherwise `runClass' will cause an infinite loop.


To go from an abstract class to a concrete class, all we need to do is
provide the missing property.



Quick sanity check


* runClass testFact ? ?fact ==&amp;gt; 3628800


Example of overloading.


It is tempting to use the following definition
  overrideFact r = testFact r ? let ?fact = product [1.. ?n] in Rec
However, this will use `?n' from the current environment and not respond
to `?n' being overridden in a subclass.



The final example concerns multiple inheritance.  We first define a
class for computing Fibonacci numbers, similar to the one for the
factorial above.



A multiple-inheritance combinator



This is C++-style inheritance: We now have two copies of the field `?n'.

* runClass testFactFib ? ?fact ==&amp;gt; 3628800
* runClass testFactFib ? ?fib ==&amp;gt; 5

However, if we were to update `?n' in a subclass, both the factorial and
the Fibonacci class would both use the new value.

Alternatively, we can force the class to use a single value for `?n' by
making sure `?n' only occurs once in the list of fields, but it's
anyone's guess which value GHC will pick for `?n'.


* runClass testFactFib' ? ?fact ==&amp;gt; 120
* runClass testFactFib' ? ?fib ==&amp;gt; 5

Thomas

[1] http://hackage.haskell.org/trac/ghc/wiki/Records
&lt;/pre&gt;</description>
    <dc:creator>Thomas Jaeger</dc:creator>
    <dc:date>2013-05-18T08:51:50</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105334">
    <title>question about GADT and deriving automatically aShow instance</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105334</link>
    <description>&lt;pre&gt;Hi everybody,

I have a question about deriving automatically a Show instance when using 
GADT.
It works in this situation:

----------------------------
{-# LANGUAGE GADTs #-}

data Male
data Female

data Person gender where
    Dead :: Person gender
    Alive :: { name :: String
              , weight :: Float
              , father :: Person gender } -&amp;gt; Person gender
     deriving Show

main = do

let a = Alive "Joe" 60 Dead :: Person Male
let b = Alive "Jim" 70 a :: Person Male

print a
print b
----------------------------

Indeed:

$ runghc test_show.hs 
Alive {name = "Joe", weight = 60.0, father = Dead}
Alive {name = "Jim", weight = 70.0, father = Alive {name = "Joe", weight = 
60.0, father = Dead}}


But when I replace "father :: Person gender" by "father :: Person gender2" 
in the code (this is one of the advantages of GADT: with a classical 
algebraic data type declaration, gender2 would have to be a type variable 
for the data type), I obtain:

Can't make a derived instance of `Show (Person gender)':
      Constructor `Alive' must have a Haskell-98 type
      Possible fix: use a standalone deriving declaration instead
    In the data declaration for `Person'

So I modify my code by removing "deriving Show", and adding the line:
----------------------------
instance Show (Person gender)
----------------------------

But now, I obtain:

$ runghc test_show.hs 
GHC stack-space overflow: current limit is 536870912 bytes.
Use the `-K&amp;lt;size&amp;gt;' option to increase it.

Why (I imagine this is because there is an infinite loop in the construction 
of the show function)? Is there any workaround?

Thanks,

TP
&lt;/pre&gt;</description>
    <dc:creator>TP</dc:creator>
    <dc:date>2013-05-17T14:32:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105332">
    <title>type-level integers for GHC</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105332</link>
    <description>&lt;pre&gt;What is your recommendation for type-level integers?

I'd like to use it to improve the unittyped,
https://bitbucket.org/xnyhps/haskell-unittyped/ the library for
physical dimension. Therefore, I need negative numbers, additions, but
multiplications are not necessary.

I've been looking forward for the type-nats extension of GHC, but I
haven't been able to compile the type-nats branch. Just learned that
it still takes a few month to merge the branch into the main.
http://hackage.haskell.org/trac/ghc/wiki/Status/May13

Thijs, the original author of unittyped, has commited a branch that
uses type-nats, but I can't try that out for the same reason.


Best,
--
Takayuki MURANUSHI
The Hakubi Center for Advanced Research, Kyoto University
http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html
&lt;/pre&gt;</description>
    <dc:creator>Takayuki Muranushi</dc:creator>
    <dc:date>2013-05-17T06:17:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105331">
    <title>Lambda expressions (core) to categorical form</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105331</link>
    <description>&lt;pre&gt;I want to convert lambda expressions into a vocabulary of monoidal
categories, so that they can be given multiple interpretations, including
circuit generation and timing analysis, and hopefully some other far-out
alternatives (3D visualization, animated evaluation, etc). More
specifically, I want a GHC plugin that makes this transformation on GHC's
Core language.

If you know of related work, have suggestions, and/or are interested in
collaborating/consulting, I'd love to hear.

Thanks,

  - Conal
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>Conal Elliott</dc:creator>
    <dc:date>2013-05-16T23:50:34</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105325">
    <title>List comprehensions with Word8</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105325</link>
    <description>&lt;pre&gt;Hello everyone,

I was playing with Word8 and list comprehensions and
the following examples came up. I have to admit the
behavior looks quite strange because it does not seem
to be consistent. Can someone shed some light on reason
behind some of these outputs?

By the way, I have abbreviated some outputs with ellipsis ...

[1..10] :: [Word8]
[1,2,3,4,5,6,7,8,9,10]

[1..100] :: [Word8]
[1,2,3,4,5,6,7,8,9,10,...,100]

[1..1000] :: [Word8]
[1,2,3,4,5,6,7,8,9,10,...,232]

[1..10000] :: [Word8]
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]

[1..100000] :: [Word8]
[1,2,3,4,5,6,7,8,9,10,...,160]

[1..1000000] :: [Word8]
[1,2,3,4,5,6,7,8,9,10,...,64]

[1..10000000] :: [Word8]
[1,2,3,4,5,6,7,8,9,10,...,128]

[1..100000000] :: [Word8]
[]

[1..1000000000] :: [Word8]
[]

Thank you,
Jose

&lt;/pre&gt;</description>
    <dc:creator>Jose A. Lopes</dc:creator>
    <dc:date>2013-05-16T21:15:33</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105321">
    <title>Infrastructure for testing the impact of a Functor/Applicative/Monad hierarchy</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105321</link>
    <description>&lt;pre&gt;Reading the other thread (Adding Applicative/Functor instances to all
Monads in GHC) I was wondering if there was infrastructure for testing
what effect making the often-discussed Functor/Monad change would have:
How many packages on hackage would break etc.

I have read a few times that people have "compiled all of hackage" to
see the impact of whatever.

How do you do that?

Do you just run a loop around cabal install or have you built some more
advanced tools to visualize the results better or compile the packages
"from ground up", in order of their dependencies?

I'm interested in anything in this direction.
&lt;/pre&gt;</description>
    <dc:creator>Niklas Hambüchen</dc:creator>
    <dc:date>2013-05-16T15:06:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105308">
    <title>Good to find you on LinkedIn</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105308</link>
    <description>&lt;pre&gt;LinkedIn
------------




    Daniel Díaz Casanueva requested to add you as a connection on LinkedIn:
  

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

Minh Thu,

I'd like to add you to my professional network on LinkedIn.

- Daniel

Accept invitation from Daniel Díaz Casanueva
http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I790933864_20/3wOtCVFbmdxnSVFbm8JrnpKqlZJrmZzbmNJpjRQnOpBtn9QfmhBt71BoSd1p65Lr6lOfP0OnPgSe3cPej0VdQALl4EOm5kPtSALdz8PcPwNdP0PcP4LrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=false&amp;amp;tok=0mY1dMLBAo4lM1

View profile of Daniel Díaz Casanueva
http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/rso/255311896/LIky/name/22724543_I790933864_20/?hs=false&amp;amp;tok=2n9H_NXUco4lM1
------------------------------------------
You are receiving Invitation emails.


This email was intended for Minh Thu Vo.
Learn why this is included: http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=false&amp;amp;tok=0pRQwEVKAo4lM1

(c) 2012, LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.


  
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>Daniel Díaz Casanueva</dc:creator>
    <dc:date>2013-05-15T21:44:08</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105301">
    <title>Propositions in Haskell</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105301</link>
    <description>&lt;pre&gt;_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>Patrick Browne</dc:creator>
    <dc:date>2013-05-15T15:34:28</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105278">
    <title>list comprehension doesn't work</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105278</link>
    <description>&lt;pre&gt;Hi,

I have to write a function which returns a list of all pairs (x,y) where x,
y ∈ N AND:
–  x is the product of two natural numbers (x = a · b, where a, b ∈ N) AND
–  x is really bigger than 5 but really smaller than 500, AND
–  y is a squer number (y = c² where c ∈ N) NOT greater than 1000, AND
–  x is a divisor of y.

My attempt is as follows:

listPairs :: [(Int, Int)]
listPairs = [(x,y) | x&amp;lt;-[0..], y&amp;lt;-[0..], x&amp;lt;-[0..]*[0..], x &amp;gt; 5, x &amp;lt; 500,
(y*y) &amp;lt; 1001, mod y x == 0]

However it doesn't work unfortunatly 

Could anyone tell me where my mistake is?

Thanks.



--
View this message in context: http://haskell.1045720.n5.nabble.com/list-comprehension-doesn-t-work-tp5730158.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>John</dc:creator>
    <dc:date>2013-05-14T14:57:31</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105277">
    <title>Trouble with Debug.Trace when using a library</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105277</link>
    <description>&lt;pre&gt;My project is split in two packages, A and B, where B uses A. All together,
there are about 100 haskell modules.
Currently, there seems to be a loop somewere, that only seems to occur when
working with rather large datastructures. I use trace (from Debug.Trace) to
see what exactly is going on. 
As long as I trace functions from B, trace works as expected. However, at
some point I need to trace into functions supplied by package A.

In package A I have a function like this: (I have simplified the function)

fA :: SomeInput -&amp;gt; SomeResult
fA a =  let x = f a
          in trace ("Entering fA") x

(The function f is defined in package A)

In package B, I have a function like this:

fB :: SomeInput -&amp;gt; SomeResult
fB a = let x = fA a
         in trace ( "Entering fB") x

At runtime, I get the message
Entering fB

and then nothing more. a lot of cpu is used, but no more output.

I have made some wrappers like the ones above. As long as they are in the
same package, trace works fine. However, when entering a function from the
other package, there is no more debug output. 

This is very anoying. Anyone some suggestions? Is this a bug?

I use the haskell platform 12.4.0.0 on a windows 7 machine.




--
View this message in context: http://haskell.1045720.n5.nabble.com/Trouble-with-Debug-Trace-when-using-a-library-tp5730157.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
&lt;/pre&gt;</description>
    <dc:creator>hanjoosten</dc:creator>
    <dc:date>2013-05-14T13:03:00</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105275">
    <title>whats with cabal and libgmp.so.3</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105275</link>
    <description>&lt;pre&gt;Today cabal suddenly started giving me errors that libgmp.so.3 is not found
Moving away my old .cabal makes it work again

Any explanations?

[I am on debian testing. I think the causing factor was that debian
switched major versions recently.
There were a lot of updates... Nothing that looked like it was related to
ghc]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe&amp;lt; at &amp;gt;haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
&lt;/pre&gt;</description>
    <dc:creator>Rustom Mody</dc:creator>
    <dc:date>2013-05-14T07:46:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105267">
    <title>fromIntegral not enough?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.haskell.cafe/105267</link>
    <description>&lt;pre&gt;This is probably a haskell-beginners sort of question, but I usually get
about 4x as many responses from cafe, about 10x as fast.

I have code like so:

code:
--------
data Xy a = Xy a a

class Coord2 a where

  coords2 :: Fractional b =&amp;gt; a b -&amp;gt; Xy b

data CircAppr a b = CircAppr a b b -- number of points, rotation angle,
radius
    deriving (Show)

instance Integral a =&amp;gt; Coord2 (CircAppr a) where

  coords2 (CircAppr divns ang rad) =
      let dAng = 2 * pi / (fromIntegral divns) in
      let angles = map (* dAng) [0..divns] in
      undefined -- To be coded...
--------

In the instance definition divns is an integral trying to divide a
fractional. I hoped wrapping it in fromIntegral would coerce, but
apparently not:

quote:
--------
    Could not deduce (Fractional a) arising from a use of `/'
    from the context (Integral a)
      bound by the instance declaration
      at /scratch/cmhoward/pulse-spin/pulse-spin.hs:34:10-42
    or from (Fractional b)
      bound by the type signature for
                 coords2 :: Fractional b =&amp;gt; CircAppr a b -&amp;gt; Xy b
      at /scratch/cmhoward/pulse-spin/pulse-spin.hs:(36,3)-(39,15)
    Possible fix:
      add (Fractional a) to the context of
        the type signature for
          coords2 :: Fractional b =&amp;gt; CircAppr a b -&amp;gt; Xy b
        or the instance declaration
    In the expression: 2 * pi / (fromIntegral divns)
    In an equation for `dAng': dAng = 2 * pi / (fromIntegral divns)
    In the expression:
      let dAng = 2 * pi / (fromIntegral divns) in
      let angles = map (* dAng) [0 .. divns] in undefined
--------

So, I'm wondering how I can do what I'm trying to do here, while still
keeping my types as generic as possible.

&lt;/pre&gt;</description>
    <dc:creator>Christopher Howard</dc:creator>
    <dc:date>2013-05-13T22:08:26</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lang.haskell.cafe">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.haskell.cafe</link>
  </textinput>
</rdf:RDF>
