Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/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:  How to show a predicate (Lyndon Maydwell)
   2.  warning in making instances of Functor class! (Abhijit Patel)
   3.  FW: Initial startup of GHCi (Windows) v. 7.10.3
      ([email protected])
   4. Re:  FW: Initial startup of GHCi (Windows) v.     7.10.3
      (Stephen Tetley)
   5. Re:  warning in making instances of Functor       class!
      (Imants Cekusins)
   6. Re:  explaining effects (Rein Henrichs)
   7. Re:  explaining effects (Christopher Allen)


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

Message: 1
Date: Fri, 25 Dec 2015 22:11:16 +0800
From: Lyndon Maydwell <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to show a predicate
Message-ID:
        <cam5qztwd1hhpcht2cofhs0hjfledbworbcxqdmejhqaog2g...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Depending on how you construct your predicates, you may be able to capture
their composition... And then serialise that.

For example:

If you were doing some sort of range intersection predicate construction ~

    R1 n R2 n R3

Could be represented as a list of those ranges [(l1,r1),(l2,r2),(l3,r3)].
Basically, instead of constructing a predicate function directly, you would
assemble a data-structure representing the essence of the predicate, then
convert that to both a function for evaluation, as well as a string for
serialisation. This would also allow you to perform some "optimisation"
before serialisation which could be fun.

Do you have some examples of what the predicates look like?


 - Lyndon

On Wed, Dec 23, 2015 at 8:55 PM, martin <[email protected]> wrote:

> Hello all,
>
> in my program, I do stuff with predicates (a->Bool). For the most part
> this representation is just fine, but at the very
> end I need to convert a resulting predicate into a String so I can write
> it to a file.
>
> Wenn I represent my predicates as Lists or Sets, then this is doable and I
> am tempted to do it this way. The only other
> option I could come up with was to have a representation of "everything",
> which would in my case be large (10^8) but
> finite. Then I could construct a List or a Set at the very end, as [x |
> x<-everything, p x] without having explicit sets
> in the intermediate steps.
>
> I cannot see any other option, but I thought I better ask.
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151225/f4a2a7ae/attachment-0001.html>

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

Message: 2
Date: Sat, 26 Dec 2015 00:02:19 +0530
From: Abhijit Patel <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] warning in making instances of Functor
        class!
Message-ID:
        <CAEr_=iwjfgttcwbd7rb8sl2kdlo-srnne6lil6boc1vh3x5...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

why am i getting warning in the following code?? though it works
perfectly!!!

Prelude> newtype Pair1  c b a=Pair1 {getPair1 :: (a,b,c)}

Prelude> :{
Prelude| instance Functor (Pair1 m n) where
Prelude| fmap f (Pair1 (x,y,z))=Pair1 (f x,y,z)
Prelude| :}

<interactive>:55:10: Warning:
    No explicit implementation for
      ?Prelude.fmap?
    In the instance declaration for ?Functor (Pair1 m n)?

-- The below shows it is working fine!
Prelude> getPair1 $ fmap (*100) (Pair1 (2,3,1))
(200,3,1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151226/f0d13459/attachment-0001.html>

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

Message: 3
Date: Fri, 25 Dec 2015 11:13:33 -0800
From: <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [Haskell-beginners] FW: Initial startup of GHCi (Windows) v.
        7.10.3
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"


Running on windows 10, GHC interactive fails to load any standard packages. The 
startup? message does not include the prompt about initializing packages do, as 
shown commonly on Haskell getting started tutorials. Instead I see:

GHCi, version 7.10.3: http://www.haskell.org/ghc/? :? for help
Prelude> :l Data.Text

<no location info>: module ?Data.Text? is a package module
Failed, modules loaded: none.
Prelude>

Any pointers on what to do next?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151225/a1d9523a/attachment-0001.html>

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

Message: 4
Date: Fri, 25 Dec 2015 19:51:11 +0000
From: Stephen Tetley <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] FW: Initial startup of GHCi (Windows)
        v.      7.10.3
Message-ID:
        <cab2tprdq+jvrbepwdjssxx0pqzsmvcwqkytkmo3ouom8z25...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

You need to use :m (or :module) to load (preinstalled) modules rather
than files, e.g:

Prelude> :m Data.Text
Prelude Data.Text>

Best wishes


On 25 December 2015 at 19:13,  <[email protected]> wrote:
>
>
> Running on windows 10, GHC interactive fails to load any standard packages.
> The startup  message does not include the prompt about initializing packages
> do, as shown commonly on Haskell getting started tutorials. Instead I see:
>
>
>
> GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
>
> Prelude> :l Data.Text
>
>
>
> <no location info>: module ?Data.Text? is a package module
>
> Failed, modules loaded: none.
>
> Prelude>
>
>
>
> Any pointers on what to do next?
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>


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

Message: 5
Date: Fri, 25 Dec 2015 20:56:17 +0100
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] warning in making instances of
        Functor class!
Message-ID:
        <CAP1qinbKaXFHfDK92ZyaojfOQr9ikV4UkmmWWfNr+9c=bt1...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hello Abhijit

a properly formatted statement as you intended it is:

instance Functor (Pair1 m n) where
       fmap f (Pair1 (x,y,z))=Pair1 (f x,y,z)

note the indent before fmap.

without the tab,

fmap f (Pair1 (x,y,z))=Pair1 (f x,y,z)
is just a stand alone function delcaration

if you enter  instance.. line #1 but not the fmap line #2, you will
see the same warning you are seeing.

if you enter #2 but not #1, this line:
getPair1 $ fmap (*100) (Pair1 (2,3,1))
will work fine too.


basically, flush (no indent) line begins a new code block


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

Message: 6
Date: Sat, 26 Dec 2015 02:19:21 +0000
From: Rein Henrichs <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] explaining effects
Message-ID:
        <cajp6g8wzvv7rrm-ybay_afj73cb_b8ylf7uywymetw_s61n...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

There is no exact definition of "effect" so this discussion must
necessarily be vague and probably not very enlightening. The State Monad
may or may not have effects, depending on your definition, but it is
definitely pure.
On Wed, Dec 23, 2015 at 5:46 AM Imants Cekusins <[email protected]> wrote:

> > What is the exact defintion of "effect".
>
> let's try:
>
> effect:
> A change which is a consequence of an action (in this case, function call)
>
> side effect:
> change of environment state which is a consequence of an action (function
> call)
>
> pure function:
> calling this function does not affect environment state
> function returns a value, that's all
>
> I am not sure if function running inside e.g. state monad and
> modifying this monad's state is pure, i.e. if state monad is
> environment
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151226/014b80dc/attachment-0001.html>

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

Message: 7
Date: Fri, 25 Dec 2015 20:56:14 -0600
From: Christopher Allen <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] explaining effects
Message-ID:
        <CADnndOpW7=HF=qdfsyymo_wga+ms6rdvq6bwmqpsq5yfkqv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Incidentally, IO is pure too

On Fri, Dec 25, 2015 at 8:19 PM, Rein Henrichs <[email protected]>
wrote:

> There is no exact definition of "effect" so this discussion must
> necessarily be vague and probably not very enlightening. The State Monad
> may or may not have effects, depending on your definition, but it is
> definitely pure.
>
> On Wed, Dec 23, 2015 at 5:46 AM Imants Cekusins <[email protected]> wrote:
>
>> > What is the exact defintion of "effect".
>>
>> let's try:
>>
>> effect:
>> A change which is a consequence of an action (in this case, function call)
>>
>> side effect:
>> change of environment state which is a consequence of an action (function
>> call)
>>
>> pure function:
>> calling this function does not affect environment state
>> function returns a value, that's all
>>
>> I am not sure if function running inside e.g. state monad and
>> modifying this monad's state is pure, i.e. if state monad is
>> environment
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>


-- 
Chris Allen
Currently working on http://haskellbook.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20151225/872b85fc/attachment.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 90, Issue 43
*****************************************

Reply via email to