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: Concrete instance of abstract class (Adrian May)
2. Re: Haskell make/ant replacement? (Kelleher, Kevin)
----------------------------------------------------------------------
Message: 1
Date: Thu, 6 Jun 2013 14:01:34 +0800
From: Adrian May <[email protected]>
Subject: Re: [Haskell-beginners] Concrete instance of abstract class
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<cad-ubzeyayz-vycheyjkp5k3m0i9k863gx-dy_y41etfmj6...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Yippee! I fixed something myself for a change...
class Turtlish t where
type Context t :: *
type Content t :: *
construct :: Content t -> Context t -> t
destruct :: t -> (Content t, Context t)
* combine :: t -> t -> Content t*
* contemp :: t -> t -> Context t*
conform :: Context t -> t -> t
present :: t -> Dia
content :: t -> Content t
content = fst.destruct
context :: t -> Context t
context = snd.destruct
(>>>),(+++) :: t -> t -> t
* x +++ y = construct (x `combine` y) (x `contemp` y)*
x >>> y = x +++ conform (context x) y
Seems like it doesn't like seeing *only* associated types in a signature.
Adrian.
On 6 June 2013 13:40, Adrian May <[email protected]> wrote:
> I'm starting to tidy it up:
>
> class Turtlish t where
> type Context t :: *
> type Content t :: *
> construct :: Content t -> Context t -> t
> destruct :: t -> (Content t, Context t)
> combine :: Content t -> Content t -> Content t
> contemp :: Context t -> Context t -> Context t
> conform :: Context t -> t -> t
> present :: t -> Dia
> content :: t -> Content t
> content = fst.destruct
> context :: t -> Context t
> context = snd.destruct
> (>>>),(+++) :: t -> t -> t
> x +++ y = construct (content x `combine` content y) (context x
> `contemp` context y)
> x >>> y = x +++ conform (context x) y
>
> but I hit this:
>
>
> turtle.hs:23:32:
> Could not deduce (Content t ~ Content t0)
> from the context (Turtlish t)
> bound by the class declaration for `Turtlish'
> at turtle.hs:(9,1)-(24,47)
> NB: `Content' is a type function, and may not be injective
> In the return type of a call of `content'
> In the first argument of `combine', namely `content x'
> In the first argument of `construct', namely
> `(content x `combine` content y)'
>
> turtle.hs:23:64:
> Could not deduce (Context t ~ Context t1)
> from the context (Turtlish t)
> bound by the class declaration for `Turtlish'
> at turtle.hs:(9,1)-(24,47)
> NB: `Context' is a type function, and may not be injective
> In the return type of a call of `context'
> In the first argument of `contemp', namely `context x'
> In the second argument of `construct', namely
> `(context x `contemp` context y)'
>
> What does this mean, and how do I fix it?
>
> TIA,
> Adrian.
>
>
>
>
>
>
> On 6 June 2013 11:28, Adrian May <[email protected]> wrote:
>
>>
>> Hi Brent,
>>
>>
>>> I would do this using an associated
>>> type, like so:
>>>
>>> class Turtlish t where
>>> type TState t :: *
>>> pic :: t -> Dia
>>> state :: t -> TState t
>>> move :: TState t -> t -> t
>>> (>>>),(+++) :: t -> t -> t
>>> x >>> y = x +++ move (state x) y
>>>
>>>
>> Bingo. Just what I needed. But is this a Haskellish thing to do or am I
>> showing my C++ background by even wanting something like this? Anyway,
>> for the sake of any future googlers, I needed {-# LANGUAGE TypeFamilies
>> #-} and completed the instance with:
>>
>> instance Turtlish TurtWorld where
>> type TState TurtWorld = TurtState
>> ...
>>
>> Thanks,
>> Adrian.
>>
>>
>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130606/18ee10ec/attachment-0001.htm>
------------------------------
Message: 2
Date: Thu, 6 Jun 2013 09:47:08 +0000
From: "Kelleher, Kevin" <[email protected]>
Subject: Re: [Haskell-beginners] Haskell make/ant replacement?
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Message-ID:
<644E83C9A0C2C54A9F40341B5F63393716B6E93C@CAMBOSEXC06.camelot.local>
Content-Type: text/plain; charset="us-ascii"
Thanks to you and the others who pointed me there!
Kevin
From: [email protected] [mailto:[email protected]] On
Behalf Of Bob Ippolito
Sent: Wednesday, June 05, 2013 10:13 AM
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level
topics related to Haskell
Subject: Re: [Haskell-beginners] Haskell make/ant replacement?
Sounds like you're looking for Shake: http://community.haskell.org/~ndm/shake/
On Wednesday, June 5, 2013, Kelleher, Kevin wrote:
Is there a tool like "make" or "ant" that's written in Haskell?
I recall seeing something about a bit of software written in Haskell
that does dependency-checking for builds.
To be clear, I mean a tool that is generic in the sense that it
would build anything, not just code written in Haskell.
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]<javascript:;>
http://www.haskell.org/mailman/listinfo/beginners
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130606/b0bd8d3b/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 60, Issue 10
*****************************************