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.  Cannot find cause of space leak (YCH)
   2. Re:  Cannot find cause of space leak (Kim-Ee Yeoh)
   3. Re:  Cannot find cause of space leak (YCH)
   4.  Cabal reset/restart (Gregory Guthrie)


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

Message: 1
Date: Sun, 01 Feb 2015 00:39:41 +0900
From: YCH <[email protected]>
To: haskell-beginners <[email protected]>
Subject: [Haskell-beginners] Cannot find cause of space leak
Message-ID: <2191211.qPyKtf21Jc@ych>
Content-Type: text/plain; charset="us-ascii"

Hello Haskellers,

http://lpaste.net/119693

~~~
{-# LANGUAGE TemplateHaskell #-}

import Test.Tasty
import Test.Tasty.TH
import Test.Tasty.QuickCheck

main :: IO ()
main = defaultMain tests

tests = $(testGroupGenerator)

-- Problem 15
--
-- (**) Replicate the elements of a list a given number of times.
--
-- Example:
--
-- * (repli '(a b c) 3)
-- (A A A B B B C C C)
--
-- Example in Haskell:
--
-- >>> repli "abc" 3
-- "aaabbbccc"

prop_repli xs n = a && b
    where
        types = ((xs::[Int]), (n::Int))
        ys = repli xs n
        ys' = groupByN ys n
            where
                groupByN [] _ = []
                groupByN zs m = take m zs : groupByN (drop m zs) m
        a = and $ fmap ((==n).length) ys'
        b = and $ fmap f ys'
            where f (x:xs) = all (==x) xs

repli :: [a] -> Int -> [a]
repli [] _ = []
repli (x:xs) n
    | n <= 1 = (x:xs)
    | otherwise = repli' x n ++ repli xs n
        where
            repli' x' 0 = []
            repli' x' n' = x':repli' x' (n'-1)

~~~

> prop_repli xs n = a && b

If I set 'n' as ' n>=1', it's ok. But with just n, does not terminate.

Any advice would be appreciated.

Thanks.

-- 
YCH


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

Message: 2
Date: Sun, 1 Feb 2015 00:03:05 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Cannot find cause of space leak
Message-ID:
        <CAPY+ZdTCvh3jbhH2m-=noz_gemt70mpfgpf+jd3k+azgras...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sat, Jan 31, 2015 at 10:39 PM, YCH <[email protected]> wrote:

>         ys' = groupByN ys n
>             where
>                 groupByN [] _ = []
>                 groupByN zs m = take m zs : groupByN (drop m zs) m
>

This groupByN doesn't look like it'll terminate for negative n. So ys'
becomes an infinite list. Which causes divergence downstream.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20150201/1cff0b27/attachment-0001.html>

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

Message: 3
Date: Sun, 1 Feb 2015 02:10:00 +0900
From: YCH <[email protected]>
To: haskell-beginners <[email protected]>
Subject: Re: [Haskell-beginners] Cannot find cause of space leak
Message-ID:
        <CAPtM4g=m6a3zawzjteqskclpowhwjjj_6qf_hq2jehdtgf_...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

2015. 2. 1. ?? 2:03? "Kim-Ee Yeoh" <[email protected]>?? ??:
>
>
> On Sat, Jan 31, 2015 at 10:39 PM, YCH <[email protected]> wrote:
>>
>>         ys' = groupByN ys n
>>             where
>>                 groupByN [] _ = []
>>                 groupByN zs m = take m zs : groupByN (drop m zs) m
>
>
> This groupByN doesn't look like it'll terminate for negative n. So ys'
becomes an infinite list. Which causes divergence downstream.
>
> -- Kim-Ee

Thanks, Kim-Ee. Now I can see.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20150201/e34442f9/attachment-0001.html>

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

Message: 4
Date: Sat, 31 Jan 2015 21:13:02 -0600
From: Gregory Guthrie <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [Haskell-beginners] Cabal reset/restart
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="us-ascii"

I did a complete reset and restart of Haskell & Cabal, and trying to re-install 
my former packages on a new clean system, most went easily but there are 
already a number which would not install. (Deleted .ghc, .cabal, and .sandbox; 
reinstalled Platform).



1) "ghc-pkg check" indicates a lot of issues (although most seemed to be 
warnings about missing .hi or haddock html files).



Many seem to be related to looking for older versions, e.g. it complains that:

  There are problems in package Win32-2.2.2.0:

  Warning: library-dirs: E:\Plang\Haskell Platform\lib\Win32-2.2.2.0 doesn't 
exist or isn't a directory

  Warning: include-dirs: E:\Plang\Haskell Platform\lib\Win32-2.2.2.0\include 
doesn't exist or isn't a directory

  import-dirs: E:\Plang\Haskell Platform\lib\Win32-2.2.2.0 doesn't exist or 
isn't a directory

  cannot find any of 
["libHSWin32-2.2.2.0.a","libHSWin32-2.2.2.0.p_a","libHSWin32-2.2.2.0-ghc7.8.3.so","libHSWin32-2.2.2.0-
 ghc7.8.3.dylib","HSWin32-2.2.2.0-ghc7.8.3.dll"] on library path



And indeed it is not there, but Win32-2.3.0.2 is present, and similarly for 
most all others that I see.

So why are these being reported as problems, and what to do?



2) cabal install of several of my previous packages fails; is there just some 
intrinsic incompatibility of these packages, or some other error?



An example:

    C:\Users\myUser\.cabal-sandbox>cabal install cgi

    Resolving dependencies...

    In order, the following would be installed:

    exceptions-0.6.1 (reinstall) changes: mtl-2.1.3.1 -> 2.2.1,

    transformers-0.3.0.0 -> 0.4.2.0

    network-2.6.0.2 (new version)

    cgi-3001.2.2.0 (new version)

    cabal: The following packages are likely to be broken by the reinstalls:

    temporary-1.2.0.3

    ghc-mod-5.2.1.2

    either-4.3.3

    monad-journal-0.7

    Use --force-reinstalls if you want to install anyway.



3) ghc-pkg check indicates a lot of broken packages for a new installation, 
Although all those that I checked of these are from old versioning as above, 
and there really is a good and more current version installed:



The following packages are broken, either because they have a problem listed 
above, or because they depend on a broken package.

Win32-2.2.2.0

time-1.4

template-haskell-2.7.0.0

regex-base-0.93.2

process-1.1.0.1

pretty-1.1.1.0

parsec-3.1.3

old-time-1.1.0.0

old-locale-1.0.0.4

integer-gmp-0.4.0.0

HTTP-4000.2.5

hpc-0.5.1.1

hoopl-3.8.7.3

haskell98-2.0.0.1

haskell2010-1.1.0.1

haskell-platform-2012.4.0.0

ghc-prim-0.2.0.0

ghc-7.4.2

filepath-1.3.0.0

fgl-5.4.2.4

extensible-exceptions-0.1.1.4

directory-1.1.0.2

deepseq-1.3.0.0

containers-0.4.2.1

cgi-3001.1.7.4

Cabal-1.14.0

bytestring-0.9.2.1

binary-0.5.1.0

base-4.5.1.0

array-0.4.0.0

zlib-0.5.4.0

xhtml-3000.2.1

vector-0.10.0.1

transformers-0.3.0.0

text-0.11.2.3

syb-0.3.7

stm-2.4

split-0.2.1.1

regex-posix-0.95.2

regex-posix-0.95.2

regex-compat-0.95.1

regex-compat-0.95.1

random-1.0.1.1

QuickCheck-2.5.1.1

primitive-0.5.0.1

parallel-3.2.0.3

OpenGL-2.2.3.1

network-2.3.1.0

HUnit-1.2.5.1

-------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20150131/844b8724/attachment-0001.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 80, Issue 1
****************************************

Reply via email to