Send Beginners mailing list submissions to beginners@haskell.org 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 beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: The (x:xs) in function parameter is a tuple? (Rein Henrichs) 2. Re: The (x:xs) in function parameter is a tuple? (Graham Gill) 3. Stack minimal dependency specification, or dependency tree output (Lyndon Maydwell) 4. Re: Stack minimal dependency specification, or dependency tree output (Mark Fine) 5. Re: Stack minimal dependency specification, or dependency tree output (Lyndon Maydwell) ---------------------------------------------------------------------- Message: 1 Date: Wed, 24 Feb 2016 18:24:06 +0000 From: Rein Henrichs <rein.henri...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] The (x:xs) in function parameter is a tuple? Message-ID: <cajp6g8zjstny94mfhpwa81w3w4wgcs7r9csy+7pueqkf7v3...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" A tuple can have any number of elements. (1,2) is a 2-tuple. (1,2,3) is a 3-tuple. (x:xs) and (x,y) are differently typed: xs must be a list of the type of x, while y can be any type. (x:xs) is not a tuple. It is a list by definition. On Wed, Feb 24, 2016 at 2:45 AM Imants Cekusins <ima...@gmail.com> wrote: > Hello Xiao, > > (one_element) -- is evaluation > (element,element,...) -- is tuple > > (1:[2]) -- [1,2] because it is one "array element" > (1,2) -- is a tuple because there are 2 elements > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160224/88384c44/attachment-0001.html> ------------------------------ Message: 2 Date: Wed, 24 Feb 2016 13:37:08 -0500 From: Graham Gill <math.simp...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] The (x:xs) in function parameter is a tuple? Message-ID: <56cdf854.7070...@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Hi Nan, are you just confused about the use of the parentheses "(" and ")"? (x1,x2), (x1,x2,x3), ... are tuples in Haskell, but (x:xs) is not. (There's no "one-ple", or 1-tuple, in Haskell.) In occurs value [] = 0 occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs the "(" and ")" around "x:xs" are just there for grouping, for operator precedence reasons. Function application binds more tightly than ":". If you leave the parentheses off, such as in occurs value x:xs = ... you'll get a parse error. Graham On 2/24/2016 5:31 AM, Nan Xiao wrote: > Hi all, > > Greetings from me! > > I am confused about the function parameters and tuple. E.g.: > > occurs value [] = 0 > occurs value (x:xs) = (if value == x then 1 else 0) + occurs value xs > > should we consider (x:xs) as a tuple? > > Thanks in advance! > > Best Regards > Nan Xiao > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ Message: 3 Date: Thu, 25 Feb 2016 08:07:04 +1100 From: Lyndon Maydwell <maydw...@gmail.com> To: Biginners Haskell Mailinglist <beginners@haskell.org> Subject: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output Message-ID: <CAM5QZtwa-T2iG=M33pYaMZASs=T3FCYx8X_7j8nzfM5tSSH=4...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi Beginners, I'm finally getting my hands dirty with Stack, and am using it in conjunction with Docker, but not with the built-in docker functionality. My Dockerfile is constructed so that it first installs a whole bunch of dependencies globally, like so: ... RUN stack install HUnit ... Then after that, installs the project: ... COPY . /app WORKDIR /app RUN stack install ... This means that on repeated docker builds the app build and install time should be limited to just the application itself, because the dependency builds were cached. Which is great! However, I'm currently generating the list of dependencies just by looking at the output of the stack build of the app, and this displays everything as a flat list. I'd like to see some kind of tree instead, so that when I pre-install the dependencies, I can specify a minimal list, rather than a whole slew of dependencies that would be pulled in transitively anyway. Is there an easy way to do this? Regards, - Lyndon -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160225/8be3526f/attachment-0001.html> ------------------------------ Message: 4 Date: Wed, 24 Feb 2016 14:04:19 -0800 From: Mark Fine <mark.f...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output Message-ID: <canrz_fkcb-p+ib-g4ophssyktldp62un7z_5t0zqxdpncn5...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" You can ask stack to build only dependencies and use that as a cache layer for docker. We do something like: FROM haskell:7.10 WORKDIR /app COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ RUN stack setup RUN stack build simple-app --only-dependencies COPY main /app/main COPY src /app/src RUN stack build simple-app --copy-bins On Wed, Feb 24, 2016 at 1:07 PM, Lyndon Maydwell <maydw...@gmail.com> wrote: > Hi Beginners, > > > I'm finally getting my hands dirty with Stack, and am using it in > conjunction with Docker, but not with the built-in docker functionality. > > My Dockerfile is constructed so that it first installs a whole bunch of > dependencies globally, like so: > > ... > RUN stack install HUnit > ... > > Then after that, installs the project: > > ... > COPY . /app > WORKDIR /app > RUN stack install > ... > > This means that on repeated docker builds the app build and install time > should be limited to just the application itself, because the dependency > builds were cached. Which is great! However, I'm currently generating the > list of dependencies just by looking at the output of the stack build of > the app, and this displays everything as a flat list. > > I'd like to see some kind of tree instead, so that when I pre-install the > dependencies, I can specify a minimal list, rather than a whole slew of > dependencies that would be pulled in transitively anyway. > > Is there an easy way to do this? > > > Regards, > > - Lyndon > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160224/84bcb981/attachment-0001.html> ------------------------------ Message: 5 Date: Thu, 25 Feb 2016 09:10:30 +1100 From: Lyndon Maydwell <maydw...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Stack minimal dependency specification, or dependency tree output Message-ID: <CAM5QZtyvGbo9y3=avf8halw1z0cxaoonq4oratygsfionkj...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi Mark, That would be great, and I have tried that, but there is one issue that caused me to take the current approach instead. The issue is that every change to * Setup.hs * simple-app.cabal * stack.yaml will cause the docker to consider the copy statement > COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ as a fresh checkpoint, and make the cache unusable. Since I've frequently changing stack.yaml, and app.cabal, this won't help me much. Not sure if there's a way around that with this method. Let me know if I've overlooked something with your approach! - Lyndon On Thu, Feb 25, 2016 at 9:04 AM, Mark Fine <mark.f...@gmail.com> wrote: > You can ask stack to build only dependencies and use that as a cache layer > for docker. We do something like: > > FROM haskell:7.10 > > WORKDIR /app > > COPY LICENSE Setup.hs simple-app.cabal stack.yaml /app/ > RUN stack setup > RUN stack build simple-app --only-dependencies > > COPY main /app/main > COPY src /app/src > RUN stack build simple-app --copy-bins > > > On Wed, Feb 24, 2016 at 1:07 PM, Lyndon Maydwell <maydw...@gmail.com> > wrote: > >> Hi Beginners, >> >> >> I'm finally getting my hands dirty with Stack, and am using it in >> conjunction with Docker, but not with the built-in docker functionality. >> >> My Dockerfile is constructed so that it first installs a whole bunch of >> dependencies globally, like so: >> >> ... >> RUN stack install HUnit >> ... >> >> Then after that, installs the project: >> >> ... >> COPY . /app >> WORKDIR /app >> RUN stack install >> ... >> >> This means that on repeated docker builds the app build and install time >> should be limited to just the application itself, because the dependency >> builds were cached. Which is great! However, I'm currently generating the >> list of dependencies just by looking at the output of the stack build of >> the app, and this displays everything as a flat list. >> >> I'd like to see some kind of tree instead, so that when I pre-install the >> dependencies, I can specify a minimal list, rather than a whole slew of >> dependencies that would be pulled in transitively anyway. >> >> Is there an easy way to do this? >> >> >> Regards, >> >> - Lyndon >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160225/0ce7e278/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 92, Issue 29 *****************************************