From dxld at darkboxed.org Mon Aug 1 19:04:16 2016
From: dxld at darkboxed.org (Daniel =?iso-8859-1?Q?Gr=F6ber?=)
Date: Mon, 1 Aug 2016 21:04:16 +0200
Subject: [Haskell-cafe] [ANN] ghc-mod-5.6.0.0: Supporting GHC 8.0 and Cabal
1.24
Message-ID: <20160801190416.GA10330@Eli.lan>
I'm pleased to announce the release of ghc-mod 5.6.0.0!
What's new?
===========
* Support for GHC 8.0 and Cabal 1.24
Nothing too spectacular to report here, just regular maintenance work.
* Type Contexts fixed
Thanks to @Lierdakil `ghc-mod type` now finally displays type (class)
constraints in most cases. This has been on the TODO list for a very long
while now, going back to at least GHC 7.8. GHC's API just doesn't have a
nice, simple, way for doing this and we had to resort to manually walking
the typechecked AST while collecting constraints in various places.
* Various bug fixes and smaller improvements
From the change log:
* Merge #737, `map-file` caching issues
* Merge #767, Add `browse` option to show symbol "parents"
* Fix #438, Case splitting not working
* Fix #790, Don't try to use 'cabal' or 'stack' when it's not installed
What is ghc-mod?
================
ghc-mod is both a back-end program for enhancing editors and other development
environments with support for Haskell as well as a library for abstracting the
black magic incantations required to use the GHC API in various environments,
especially Cabal and Stack projects. The library is used by projects like
HaRe[1], and haskell-ide-engine[2]
Getting ghc-mod
===============
GitHub: https://github.com/DanielG/ghc-mod
Hackage: http://hackage.haskell.org/package/ghc-mod
Editor frontends:
- Emacs (native):
https://github.com/DanielG/ghc-mod
https://github.com/iquiw/company-ghc
- Vim:
https://github.com/eagletmt/ghcmod-vim
https://github.com/eagletmt/neco-ghc
- Atom:
https://github.com/atom-haskell/ide-haskell
Known issues
============
For issues other than the ones mentioned below visit our issue tracker:
https://github.com/DanielG/ghc-mod/issues
Frequently reported issues
--------------------------
ghc-mod once compiled is bound to one version of GHC since we link against the
GHC API library. This used to not be a very big problem but since Stack made it
exceedingly easy for users to use more than one version of GHC without even
knowing the number of problems in this area has exploded. We are tracing the
issue in the following issue: https://github.com/DanielG/ghc-mod/issues/615
(Support switching GHC versions without recompiling ghc-mod)
If you do notice any other problems please report them:
https://github.com/DanielG/ghc-mod/issues/new
----
[1]: https://github.com/alanz/HaRe
[2]: https://github.com/haskell/haskell-ide-engine
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL:
From claude at mathr.co.uk Mon Aug 1 19:57:36 2016
From: claude at mathr.co.uk (Claude Heiland-Allen)
Date: Mon, 1 Aug 2016 20:57:36 +0100
Subject: [Haskell-cafe] [ANN] hgmp-0.1.0.0
Message-ID: <583e90ea-a250-9525-28d7-fc6f7991cb0f@mathr.co.uk>
Hi all,
hgmp 0.1.0.0 is released! [0]
hgmp is a Haskell interface to GMP[1] (for GHC with the default
integer-gmp implementation of Integer). Contains type definitions and
marshalling functions, to be able to write FFI bindings using Haskell's
Integer and Rational types. Function bindings may come in a future version.
A simple example illustrating binding to GMP's next probable-prime function:
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign.Ptr (Ptr(..))
import Numeric.GMP.Types (MPZ)
import Numeric.GMP.Utils (withInInteger, withOutInteger_)
import System.IO.Unsafe (unsafePerformIO)
foreign import ccall safe "__gmpz_nextprime"
mpz_nextprime :: Ptr MPZ -> Ptr MPZ -> IO ()
nextPrime :: Integer -> Integer
nextPrime n =
unsafePerformIO $
withOutInteger_ $ \rop ->
withInInteger n $ \op ->
mpz_nextprime rop op
You can cabal install (or otherwise get it) from Hackage[2], or get (or
browse[3]) the freshest sources from git:
git clone https://code.mathr.co.uk/hgmp.git
Any and all feedback welcome! I'm sure there are some things that could
be improved, and ideas for future versions will be appreciated too.
[0] https://mathr.co.uk/blog/2016-08-01_hgmp_0_1_0_0_released.html
[1] https://gmplib.org/
[2] http://hackage.haskell.org/package/hgmp
[3] https://code.mathr.co.uk/hgmp
Thanks,
Claude
--
https://mathr.co.uk
From claude at mathr.co.uk Mon Aug 1 20:48:17 2016
From: claude at mathr.co.uk (Claude Heiland-Allen)
Date: Mon, 1 Aug 2016 21:48:17 +0100
Subject: [Haskell-cafe] [ANN] hgmp-0.1.0.0
In-Reply-To:
References: <583e90ea-a250-9525-28d7-fc6f7991cb0f@mathr.co.uk>
Message-ID: <1928cf43-78e2-beb9-b0b2-ea41a922b2ef@mathr.co.uk>
Hi Sergey, café,
On 01/08/16 21:13, Sergey Bushnyak wrote:
> Nice work! How it differs from
> https://hackage.haskell.org/package/integer-gmp ?
Good question!
integer-gmp is a binding of enough of GMP to make implementing Integer
possible. It is very low level in the GHC package heirarchy, so trying
to make it provide high level code is painful, if not impossible. It
exposes the bare minimum of functionality to let most of Integer be
implemented by the base package.
hgmp uses the public integer-gmp internal details (also ghc-prim for the
lower level stuff like copying byte arrays to/from Haskell heap /
foreign memory) to expose helpers using Integer and Rational for
interacting with foreign code that expects mpz_t and mpq_t data structures.
So the package heirarchy is something like this diagram (fixed width
font recommended):
hgmp -- Integer and Rational FFI helpers for libgmp API
/ | \
| | base -- Integer numeric instances, the standard Prelude, etc
| | | :
| integer-gmp -- bindings for Integer implementation (bare minimum)
| | /
ghc-prim -- very low level compiler specifics
hgmp eventually should also contain bindings to the functions in GMP,
I'm considering the best way to go about it. My current thought is to
generate raw and higher-level bindings semi-automatically from the C API
header file gmp.h - any other suggestions?
Claude
> On 08/01/2016 10:57 PM, Claude Heiland-Allen wrote:
>> Hi all,
>>
>> hgmp 0.1.0.0 is released! [0]
>>
>> hgmp is a Haskell interface to GMP[1] (for GHC with the default
>> integer-gmp implementation of Integer). Contains type definitions and
>> marshalling functions, to be able to write FFI bindings using
>> Haskell's Integer and Rational types. Function bindings may come in a
>> future version.
>>
>> A simple example illustrating binding to GMP's next probable-prime
>> function:
>>
>> {-# LANGUAGE ForeignFunctionInterface #-}
>>
>> import Foreign.Ptr (Ptr(..))
>> import Numeric.GMP.Types (MPZ)
>> import Numeric.GMP.Utils (withInInteger, withOutInteger_)
>> import System.IO.Unsafe (unsafePerformIO)
>>
>> foreign import ccall safe "__gmpz_nextprime"
>> mpz_nextprime :: Ptr MPZ -> Ptr MPZ -> IO ()
>>
>> nextPrime :: Integer -> Integer
>> nextPrime n =
>> unsafePerformIO $
>> withOutInteger_ $ \rop ->
>> withInInteger n $ \op ->
>> mpz_nextprime rop op
>>
>> You can cabal install (or otherwise get it) from Hackage[2], or get
>> (or browse[3]) the freshest sources from git:
>>
>> git clone https://code.mathr.co.uk/hgmp.git
>>
>> Any and all feedback welcome! I'm sure there are some things that
>> could be improved, and ideas for future versions will be appreciated too.
>>
>> [0] https://mathr.co.uk/blog/2016-08-01_hgmp_0_1_0_0_released.html
>> [1] https://gmplib.org/
>> [2] http://hackage.haskell.org/package/hgmp
>> [3] https://code.mathr.co.uk/hgmp
>>
>> Thanks,
>>
>>
>> Claude
>
--
https://mathr.co.uk
From ezyang at mit.edu Mon Aug 1 21:03:35 2016
From: ezyang at mit.edu (Edward Z. Yang)
Date: Mon, 01 Aug 2016 14:03:35 -0700
Subject: [Haskell-cafe] FINAL CALL FOR TALKS (Aug 8 deadline): Haskell
Implementors Workshop 2016, Sep 24, Nara
Message-ID: <1470085297-sup-7909@sabre>
Deadline is in a week! Submit your talks!
Call for Contributions
ACM SIGPLAN Haskell Implementors' Workshop
http://haskell.org/haskellwiki/HaskellImplementorsWorkshop/2016
Nara, Japan, 24 September, 2016
Co-located with ICFP 2016
http://www.icfpconference.org/icfp2016/
Important dates
---------------
Proposal Deadline: Monday, 8 August, 2016
Notification: Monday, 22 August, 2016
Workshop: Saturday, 24 September, 2016
The 8th Haskell Implementors' Workshop is to be held alongside ICFP
2016 this year in Nara. It is a forum for people involved in the
design and development of Haskell implementations, tools, libraries,
and supporting infrastructure, to share their work and discuss future
directions and collaborations with others.
Talks and/or demos are proposed by submitting an abstract, and
selected by a small program committee. There will be no published
proceedings; the workshop will be informal and interactive, with a
flexible timetable and plenty of room for ad-hoc discussion, demos,
and impromptu short talks.
Scope and target audience
-------------------------
It is important to distinguish the Haskell Implementors' Workshop from
the Haskell Symposium which is also co-located with ICFP 2016. The
Haskell Symposium is for the publication of Haskell-related research. In
contrast, the Haskell Implementors' Workshop will have no proceedings --
although we will aim to make talk videos, slides and presented data
available with the consent of the speakers.
In the Haskell Implementors' Workshop, we hope to study the underlying
technology. We want to bring together anyone interested in the
nitty-gritty details behind turning plain-text source code into a
deployed product. Having said that, members of the wider Haskell
community are more than welcome to attend the workshop -- we need your
feedback to keep the Haskell ecosystem thriving.
The scope covers any of the following topics. There may be some topics
that people feel we've missed, so by all means submit a proposal even if
it doesn't fit exactly into one of these buckets:
* Compilation techniques
* Language features and extensions
* Type system implementation
* Concurrency and parallelism: language design and implementation
* Performance, optimisation and benchmarking
* Virtual machines and run-time systems
* Libraries and tools for development or deployment
Talks
-----
At this stage we would like to invite proposals from potential speakers
for talks and demonstrations. We are aiming for 20 minute talks with 10
minutes for questions and changeovers. We want to hear from people
writing compilers, tools, or libraries, people with cool ideas for
directions in which we should take the platform, proposals for new
features to be implemented, and half-baked crazy ideas. Please submit a
talk title and abstract of no more than 300 words.
Submissions should be made via HotCRP. The website is:
https://icfp-hiw16.hotcrp.com/
We will also have a lightning talks session which will be organised on
the day. These talks will be 5-10 minutes, depending on available time.
Suggested topics for lightning talks are to present a single idea, a
work-in-progress project, a problem to intrigue and perplex Haskell
implementors, or simply to ask for feedback and collaborators.
Organisers
--- End forwarded message ---
From yallop at gmail.com Tue Aug 2 08:35:44 2016
From: yallop at gmail.com (Jeremy Yallop)
Date: Tue, 2 Aug 2016 09:35:44 +0100
Subject: [Haskell-cafe] PEPM 2017 Second Call for Papers
Message-ID:
SECOND CALL FOR PAPERS
Workshop on PARTIAL EVALUATION AND PROGRAM MANIPULATION (PEPM 2017)
NEWS: Keynote talk by Neil Jones, DIKU (see below).
http://conf.researchr.org/home/PEPM-2017
Paris, France, January 16th - 17th, 2017
(co-located with POPL 2017)
PEPM is the premier forum for discussion of semantics-based program
manipulation. The first ACM SIGPLAN PEPM symposium took place in
1991, and meetings have been held in affiliation with POPL every year
since 2006.
PEPM 2017 will be based on a broad interpretation of semantics-based
program manipulation, reflecting the expanded scope of PEPM in recent
years beyond the traditionally covered areas of partial evaluation and
specialization. Specifically, PEPM 2017 will include practical
applications of program transformations such as refactoring tools, and
practical implementation techniques such as rule-based transformation
systems. In addition, the scope of PEPM covers manipulation and
transformations of program and system representations such as
structural and semantic models that occur in the context of
model-driven development. In order to maintain the dynamic and
interactive nature of PEPM and to encourage participation by
practitioners, we also solicit submissions of short papers, including
tool demonstrations, and of posters.
Scope
-----
Topics of interest for PEPM 2017 include, but are not limited to:
* Program and model manipulation techniques such as: supercompilation,
partial evaluation, fusion, on-the-fly program adaptation, active
libraries, program inversion, slicing, symbolic execution,
refactoring, decompilation, and obfuscation.
* Program analysis techniques that are used to drive program/model
manipulation such as: abstract interpretation, termination checking,
binding-time analysis, constraint solving, type systems, automated
testing and test case generation.
* Techniques that treat programs/models as data objects including
metaprogramming, generative programming, embedded domain-specific
languages, program synthesis by sketching and inductive programming,
staged computation, and model-driven program generation and
transformation.
* Application of the above techniques including case studies of
program manipulation in real-world (industrial, open-source)
projects and software development processes, descriptions of robust
tools capable of effectively handling realistic applications,
benchmarking. Examples of application domains include legacy
program understanding and transformation, DSL implementations,
visual languages and end-user programming, scientific computing,
middleware frameworks and infrastructure needed for distributed and
web-based applications, embedded and resource-limited computation,
and security.
This list of categories is not exhaustive, and we encourage
submissions describing applications of semantics-based program
manipulation techniques in new domains. If you have a question as to
whether a potential submission is within the scope of the workshop,
please contact the programme chairs.
Submission categories and guidelines
------------------------------------
Three kinds of submissions will be accepted: Regular Research Papers,
Short Papers and Posters.
* Regular Research Papers should describe new results, and will be
judged on originality, correctness, significance and clarity.
Regular research papers must not exceed 12 pages in ACM Proceedings
style (including appendix).
* Short Papers may include tool demonstrations and presentations of
exciting if not fully polished research, and of interesting
academic, industrial and open-source applications that are new or
unfamiliar. Short papers must not exceed 6 pages in ACM Proceedings
style (including appendix).
* Posters should describe work relevant to the PEPM community, and
must not exceed 2 pages in ACM Proceedings style. We invite poster
submissions that present early work not yet ready for submission to
a conference or journal, identify new research problems, showcase
tools and technologies developed by the author(s), or describe
student research projects.
At least one author of each accepted contribution must attend the
workshop and present the work. In the case of tool demonstration
papers, a live demonstration of the described tool is expected.
Suggested topics, evaluation criteria, and writing guidelines for both
research tool demonstration papers will be made available on the PEPM
2017 web site.
Student participants with accepted papers can apply for a SIGPLAN PAC
grant to help cover travel expenses and other support. PAC also
offers other support, such as for child-care expenses during the
meeting or for travel costs for companions of SIGPLAN members with
physical disabilities, as well as for travel from locations outside of
North America and Europe. For details on the PAC programme, see its
web page.
Publication and special issue
-----------------------------
All accepted papers, short papers and posters included, will appear in
formal proceedings published by ACM Press. Accepted papers will be
included in the ACM Digital Library. Authors of selected papers from
PEPM 2016 and PEPM 2017 will also be invited to expand their papers
for publication in a special issue of the journal Computer Languages,
Systems and Structures (COMLAN, Elsevier).
Keynote
-------
Neil Jones (DIKU) will give the PEPM keynote talk, titled
Compiling Untyped Lambda Calculus to Lower-level Code
by Game Semantics and Partial Evaluation
Best paper award
----------------
PEPM 2017 continues the tradition of a Best Paper award. The winner
will be announced at the workshop.
Submission
----------
Papers should be submitted electronically via HotCRP.
https://pepm17.hotcrp.com/
Authors using LaTeX to prepare their submissions should use the new
improved SIGPLAN proceedings style, and specifically the
sigplanconf.cls 9pt template.
Important Dates
---------------
For Regular Research Papers and Short Papers:
* Abstract submission : Tuesday 13th September 2016
* Paper submission : Friday 16th September 2016
* Author notification : Monday 24th October 2016
* Camera ready : Monday 28th November 2016
For Posters:
* Poster submission : Sunday 30th October 2016
* Author notification : Friday 10th November 2016
* Camera ready : Monday 28th November 2016
PEPM workshop:
* Workshop : Monday 16th - Tuesday 17th January 2017
The proceedings will be published 2 weeks pre-conference.
AUTHORS TAKE NOTE: The official publication date is the date the
proceedings are made available in the ACM Digital Library. This date
may be up to two weeks prior to the first day of your conference. The
official publication date affects the deadline for any patent filings
related to published work. (For those rare conferences whose
proceedings are published in the ACM Digital Library after the
conference is over, the official publication date remains the first
day of the conference.).
PEPM'17 Programme Committee
---------------------------
Elvira Albert (Complutense University of Madrid, Spain)
Don Batory (University of Texas at Austin, USA)
Martin Berger (University of Sussex, UK)
Sebastian Erdweg (TU Delft, Netherlands)
Andrew Farmer (Facebook, USA)
Matthew Flatt (University of Utah, USA)
John Gallagher (Roskilde University, Denmark)
Robert Glück (DIKU, Denmark)
Jurriaan Hage (Utrecht University, Netherlands)
Zhenjiang Hu (National Institute of Informatics, Japan)
Yukiyoshi Kameyama (University of Tsukuba, Japan)
Ilya Klyuchnikov (Facebook, UK)
Huiqing Li (EE, UK)
Annie Liu (Stony Brook University, USA)
Markus Püschel (ETH Zurich, Switzerland)
Ryosuke SATO (University of Tokyo, Japan)
Sven-Bodo Scholz (Heriot-Watt University, UK)
Ulrik Schultz (co-chair) (University of Southern Denmark)
Ilya Sergey (University College London, UK)
Chung-chieh Shan (Indiana University, USA)
Tijs van der Storm (Centrum Wiskunde & Informatica, Netherlands)
Jeremy Yallop (co-chair) (University of Cambridge, UK)
From breitner at kit.edu Tue Aug 2 12:17:09 2016
From: breitner at kit.edu (Joachim Breitner)
Date: Tue, 02 Aug 2016 08:17:09 -0400
Subject: [Haskell-cafe] Haskell in Leipzig 2016: Call for Participation
Message-ID: <1470140229.3408.30.camel@kit.edu>
Haskell in Leipzig
September 14-15, 2016
HTKW Leipzig, Germany
http://hal2016.haskell.org/
We have received many interesting submissions for HAL and were able to
assemble a great program, which you can find here:
http://hal2016.haskell.org/program.html
Abstracts and final schedule will be added soonish™.
As you can see, we have an interesting program spanning from practical,
real-word uses of Haskell over data structures and libraries to game-
and music programming. Besides the 12 talks, there are three tutorials
to attend.
As a special treat, on the evening of September 14, Anton Kholomiov
will give a live music coding performance!
If you are interested in attending, please head over to
http://nfa.imn.htwk-leipzig.de/LDEC2016/registration/
and follow the instructions. HAL is cheap, and even cheaper for
students, and yet cheaper if you pay by the early registration deadline
of August 15¹
Also check out the other two conferences of LDEC (WLP and WLFP), and if
you like them, make it a week full of functional programming!
Thanks,
Joachim Breitner
on behalf of the program committee
¹ Note that the early registration deadline is for the money, so make
sure you allow for the bank to transfer it in time.
--
Dr. rer. nat. Joachim Breitner
Wissenschaftlicher Mitarbeiter
http://pp.ipd.kit.edu/~breitner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL:
From bertram.felgenhauer at googlemail.com Tue Aug 2 12:30:58 2016
From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer)
Date: Tue, 2 Aug 2016 14:30:58 +0200
Subject: [Haskell-cafe] ANN: haskell-src-exts-simple
In-Reply-To: <20160731174037.GC25770@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f>
References: <20160731174037.GC25770@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f>
Message-ID: <20160802123058.GD11995@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f>
Bertram Felgenhauer via Haskell-Cafe wrote:
> I've just released haskell-src-exts-simple 1.18.0.0 on hackage [1].
> (This is the first release. The first two components of the version
> follow haskell-src-exts.)
I have released version 1.18.0.1 which adds support for ghc-7.8,
with a caveat: Because support for explicitly bidirectional patterns
is not available, the constructors of the `Literal` type only work
as patterns in ghc-7.8; there are separate functions for construction
f `Literal` values. In later ghc versions, the constructors can be
used for constructing values as well.
Cheers,
Bertram
P.S. I fogot to update the changelog in this release; this will be
fixed with the next release.
From julesmazur at gmail.com Tue Aug 2 20:55:53 2016
From: julesmazur at gmail.com (Jules Mazur)
Date: Tue, 02 Aug 2016 20:55:53 +0000
Subject: [Haskell-cafe] What's the state of programming on the Xeon Phi with
Haskell?
Message-ID:
I recently gained access to a Xeon Phi (Knights Corner edition, a bit dated
but useful to play around with), and I'm interested in using Haskell to
program for the Phi platform.
Sadly, the only lead I've got about working with both technologies is a 2014
paper by Liu, et al. at Intel Research (available via [this
site](https://www.researchgate.net/publication/262310691_The_Intel_Labs_Haskell_Research_Compiler)).
In a 3-month-old [Reddit
thread](https://www.reddit.com/r/haskell/comments/4hokvy/is_there_any_way_to_get_my_hands_on_intels/d2rmkzz),
one of the authors mentions that the compiler may be released at a future
date, but implied that it will likely have some degree of instability.
Are there any libraries or compilers, or even extensions or modifications for
GHC or other existing compilers, that allow compilation for the Xeon Phi?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From gurudev.devanla at gmail.com Wed Aug 3 04:40:03 2016
From: gurudev.devanla at gmail.com (Guru Devanla)
Date: Tue, 2 Aug 2016 21:40:03 -0700
Subject: [Haskell-cafe] Design Question - Functions taking 'subtype'
like arguments but has to be restricted to one type
In-Reply-To: <614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
References: <8ed829cc-3f7b-407d-a1cb-fd66785ac60a@googlegroups.com>
<614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
Message-ID:
@Marlin Thank you for the example. Looks very interesting. Initially,
when I was modelling this problem, I did consider Phanton types. But, you
do provide a nice extension using type classes.
Here are the obstacles/discomfort I faced while I took the Phantom
Polymorphism approach:
1. With the definition of Basket c, how do I create a type such as
Cart = [Basket]. The only way to create such a cart is Cart c = [Basket
c]. But, that ties the Cart to one definition of Basket. Is there a way
around this? I might be missing something simple.
2. In your approach or in the approach suggested by others, ultimately, I
end up handling the 'Frozen' type during run-time. There is no way from
stopping somene write code that calls update's on Frozen. (For example
while mapping..). Is that understanding correct?
Does this approach give me any more power than the previous approaches?
The one power is that we stop the user from being able to construct the
Frozen type, and we leave it to the compiler to return that type based on
the inference. Correct? Is there any other power.
Thank you for the help. Just with this thread, I have learnt more than 3
different ways of modelling approaches for this kind of a problem!
On Sun, Jul 31, 2016 at 11:41 AM, MarLinn via Haskell-Cafe <
haskell-cafe at haskell.org> wrote:
> This sounds like a perfect opportunity to use phantom types. I'll be using
> it's DataKind-enhanced variant for added beauty.
>
> -- An Item that can be of two types, one whose value can be changed, one
> whose value are frozen once created
> data Item = FreeToChange {freeToChangeCount:: Int}
> | CannotChange {frozenCount:: Int}
>
> I assume all items are equal apart from their changeability. Not that it's
> necessary, but it makes the demonstration simpler. If changeable and
> unchangeable items have differing structure you may need additional tools
> like smart constructors. Accordingly, my items have the type
>
> data PlainItem = PlainItem { count :: Int }
>
> Changeability will be added on top:
>
> data Changeability = Changeable | Unchangeable
>
> data Item (c :: Changeability) = Item { plainItem :: PlainItem }
>
> Why separate *Item* and *PlainItem*? One second, please.
>
> -- The item is part of a basket
> data Basket = Basket { name:: String, item::Item }
>
> data Basket c = Basket { name :: String, item :: Item c } -- No kind signature necessary. Thanks, solver.
>
>
> Therefore, valid operation are:
>
> 1. I can create an Basket with either FreeToChange item or CannotChange
> item.
>
>
> The new *Basket* constructor can do that by default.
>
> 2. I can update the count for FreeToChange item in the Basket
>
> changeItem :: (PlainItem -> PlainItem) -> Item 'Changeable -> Item 'Changeable
>
> changeItem f (Item i) = Item (f i)
>
> changeBasket :: (PlainItem -> PlainItem) -> Basket 'Changeable -> Basket 'Changeable
>
> changeBasket f basket at Basket{..} = basket { item = changeItem f item }
>
>
> And that's why *PlainItem* was separated, so we can have a simple type
> signature here. You might worry that it was exposed, but it will not give
> anyone access to a frozen basket. And of course you are free to further
> restrict access to it. And as we're speaking about freezing, that's
> extremely simple as well.
>
> freezeItem :: Item c -> Item 'Unchangeable
>
> freezeItem (Item i) = Item i
>
> freezeBasket :: Basket c -> Basket 'Unchangeable
>
> freezeBasket basket at Basket{..} = basket { item = freezeItem item }
>
>
> You later mention that you might want to map updates only over some of the
> baskets in a cart. That's not hard either. As an example, here's a way to
> implement a function that updates changeable baskets while ignoring
> unchangeable ones:
>
> class MaybeUpdateBasket c where
> updateBasket :: (PlainItem -> PlainItem) -> Basket c -> Basket c
> instance MaybeUpdateBasket 'Changeable where
> updateBasket = changeBasket
> instance MaybeUpdateBasket 'Unchangeable where
> updateBasket _ = id
>
> Just *map* it over your cart as always.
>
> If you want more complicated things (eg. you want a cart to freeze once
> any bucket freezes) you just have to expand the ideas here. You may need
> MultiParamTypeClasses and FunctionalDependencies, but the basic ideas are
> the same.
>
> Cheers.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ch.howard at zoho.com Wed Aug 3 04:54:36 2016
From: ch.howard at zoho.com (Christopher Howard)
Date: Tue, 2 Aug 2016 20:54:36 -0800
Subject: [Haskell-cafe] memory usage: general questions
Message-ID: <57A1790C.1010104@zoho.com>
Hi. I've spent the last few days reading about strictness,
non-strictness, laziness, thunks, and persistence, and to be honest I'm
still in a bit of a fog. A few questions, which I hope might help me out:
Supposing I have an expression
f (f (f b)))
where f :: B -> B
and B is some ginormous persistent data structure.
and f is an "updating" function outputting some modified copy version of
it's argument
So, a few questions:
1) Supposing that f does not short-circuit: Is it correct to say that it
is definitely advantageous (from a memory usage perspective) for f to be
a strict function? Or is this heavily dependent on whether or not b
contains unevaluated data structures (e.g., a list)?
2) As far as the overall peak size of our memory graph: How will it be
affected by the size of b, if f is non-strict? and if f is strict?
3) Are the "overwritten" portions of each B (i.e., those parts of the
persistent data we no are no longer needed) guaranteed to be pushed out
of memory at any particular point? Is this something we know will
(might?) happen as soon as the GC is run? Or does it happen right when
each f is applied to it's argument?
--
https://qlfiles.net
To protect my privacy, please use PGP encryption. It's free and easy
to use! My public key ID is 0x340EA95A (pgp.mit.edu).
From anselm.scholl at tu-harburg.de Wed Aug 3 08:06:18 2016
From: anselm.scholl at tu-harburg.de (Jonas Scholl)
Date: Wed, 3 Aug 2016 10:06:18 +0200
Subject: [Haskell-cafe] memory usage: general questions
In-Reply-To: <57A1790C.1010104@zoho.com>
References: <57A1790C.1010104@zoho.com>
Message-ID: <76e26246-fa8a-b281-18da-95fb403f5f7d@tu-harburg.de>
On 08/03/2016 06:54 AM, Christopher Howard wrote:
> Hi. I've spent the last few days reading about strictness,
> non-strictness, laziness, thunks, and persistence, and to be honest I'm
> still in a bit of a fog. A few questions, which I hope might help me out:
>
> Supposing I have an expression
>
> f (f (f b)))
>
> where f :: B -> B
> and B is some ginormous persistent data structure.
> and f is an "updating" function outputting some modified copy version of
> it's argument
>
> So, a few questions:
>
> 1) Supposing that f does not short-circuit: Is it correct to say that it
> is definitely advantageous (from a memory usage perspective) for f to be
> a strict function? Or is this heavily dependent on whether or not b
> contains unevaluated data structures (e.g., a list)?
I would say, this depends a little bit on the structure of B and how
much f forces of it. Suppose B looks like this:
data StrictList a = Cons a !(StrictList a) | Nil
data B = B Int !Int [Float] (StrictList Double)
Now lets consider some variations of f:
f (B a b c d) = B (a + 1) (b - 1) (2.5 : c) (Cons (fromIntegral a) d)
This version would only be strict in the outer constructor and would
create a B with two fields set to values and 2 to thunks. The first
field is a lazy Int, thus we can not blindly evaluate it, as it could be
_|_. Thus, we create a thunk for (a + 1), which will cost about 3 words
(function pointer and two for each argument) plus 2 words for the second
argument of (+), although the compiler may be able to optimize that away
to a statically allocated version (at least the garbage collector
recognizes small integers and replaces them with references to
statically allocated ones). The second field is strict and depends on a
strict value, thus it will just be computed and stored. If -O or
-funbox-small-strict-fields is set, it should get unpacked to an unboxed
Int#, removing any indirection via pointers. The next field is lazy
again, but we only construct values. Thus, we can construct them
directly and store the result in the field. The tail of the list may
still be lazy. The forth field contains a spine-strict list, although
the field is not marked strict, so forcing it would force the whole
list. However, elements of the list are not strict. So we get a thunk
for (fromIntegral a) (as a was lazy, we can not just compute this) and
another thunk for the constructor, which forces d (if the first element
of the list is evaluated, the whole list is evaluated, so Cons has to
evaluate d).
So is this version of f strict? It is strict in the outer layer, but we
can of course make a stricter version:
f (B !a !b !c !d) = ... (or f (B a b c d) = a `seq` b `seq` ...)
Now f would first evaluate the contents of each field of B. Thus, we
would avoid to create a space leak in the first argument of B, if we
repeatedly apply f. The second field was already strict, so nothing
changes in this case. The third field is a lazy list, thus we only
evalute the head of the list (which may be a thunk forcing additional
values) before constructing our result for this field. The last field
would now force the entire StrictList, which could increase memory usage
a lot (especially if a part of it was a thunk of the form replicate 500
1.0. The next time the StrictList is forced, it will stop after the
first Cons cell, as this being evaluated means the whole list is
evaluated. As a was already evaluated, the compiler might be able to see
that it can compute (fromIntegral a) earlier. This should take about the
same amount of work as constructing a closure, but I don't know whether
GHC does something like this today.
So the second version of f is a lot stricter, could create less thunks,
but force additional elements which would increase memory usage.
Which one is better? It depends on the use case. As you mentioned, if
you have a list or something similar to a list and consume it
incrementally, you only want to force the elements when you get to them.
However, any accumulator you carry during this should probably be
strict. Similar, if you construct a list, it could be beneficial to
force an element before constructing the cons-cell, at least for small
types like Int, and when you know that forcing them can not yield _|_.
In the end it depends heavily on your concrete problem.
>
> 2) As far as the overall peak size of our memory graph: How will it be
> affected by the size of b, if f is non-strict? and if f is strict?
If f is not strict, it can produce a B without forcing its argument. If
it just uses the argument without evaluating it, it can only store it
inside the B it constructs, so B seems to be something like a list or
tree. Or it can call a function on it, but store the thunk of the
function call in the result, so the argument is only forced if this
thunk is forced. So if f is not strict, it has to increase the memory
usage (or throw the argument away, but this does not seem sensible in
this case). If it is strict, it can extract the relevant fields and
produce a result, maybe dropping the last reference to the argument and
making it eligible for GC.
>
> 3) Are the "overwritten" portions of each B (i.e., those parts of the
> persistent data we no are no longer needed) guaranteed to be pushed out
> of memory at any particular point? Is this something we know will
> (might?) happen as soon as the GC is run? Or does it happen right when
> each f is applied to it's argument?
>
Nothing is overwritten. Instead, a new version of B is allocated and the
old one is collected after the last reference is dropped. Maybe this is
best visible if you consider (f b, g b). Overwriting parts of b in f
would change the argument to g. Thus, a copy has to be produced. It
would be valid if the compiler could prove that only one reference
exists and this is passed to f, but first this proof could be difficult
and second a separate version of f would have to be compiled. This may
even reduce performance, as the GC is exploiting the fact that most data
structures are immutable (although thunks are mutable as they are
overwritten by their result). Thus, such an optimization could hurt the
GC, which would result in a global slowdown, further reducing any gains
from overwriting the contents of the argument. Additionally, GCs are
quite cheep if not much data is alive.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL:
From alan.zimm at gmail.com Wed Aug 3 11:20:25 2016
From: alan.zimm at gmail.com (Alan & Kim Zimmerman)
Date: Wed, 3 Aug 2016 13:20:25 +0200
Subject: [Haskell-cafe] [ANN] HaRe 0.8.3.0 Released
Message-ID:
Now that ghc-mod 5.6.0.0 is out, I have been able to release HaRe for GHC
8.0.1
There are no functional changes, this release just adds support for GHC
8.0.1.
Just a heads up for anyone who is interested, my plans for the near future
are
1. Complete adding default annotations to ghc-exactprint.
This will allow pretty printing a GHC AST that has been generated via some
process other than parsing source, by adding annotations to it.
2. Return to haskell-ide-engine
The initial focus will be on enabling the remote ghci mode into it.
In general, my focus is on improving the tooling experience around GHC.
Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From monkleyon at googlemail.com Wed Aug 3 14:58:28 2016
From: monkleyon at googlemail.com (MarLinn)
Date: Wed, 3 Aug 2016 16:58:28 +0200
Subject: [Haskell-cafe] Design Question - Functions taking 'subtype'
like arguments but has to be restricted to one type
In-Reply-To:
References: <8ed829cc-3f7b-407d-a1cb-fd66785ac60a@googlegroups.com>
<614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
Message-ID:
An HTML attachment was scrubbed...
URL:
From mitchellwrosen at gmail.com Wed Aug 3 15:42:29 2016
From: mitchellwrosen at gmail.com (Mitchell Rosen)
Date: Wed, 3 Aug 2016 08:42:29 -0700 (PDT)
Subject: [Haskell-cafe] Measuring allocations with 'weigh' - what about
thunks?
Message-ID:
weigh (https://www.fpcomplete.com/blog/2016/05/weigh-package) is a library
measures how much allocation evaluating a function causes. It's basically a
nice interface to GHC.Stats.getGCStats.
Here is an example that measures *\n -> n+1*:
import Weigh
main :: IO ()
main = mainWith (func "+1" plusOne 5)
plusOne :: Int -> Int
plusOne = \n -> n + 1
which prints
Case Bytes GCs Check
+1 16 0 OK
when run (64 bit machine; allocating 1 Int = 16 bytes).
So my question is, what about the thunk allocated by *(+)*? My rough
understanding of the heap is this:
Code Heap
---- ----
1 1 1 1 1
plusOne 1 +-------+----------+----+ +----+---+
| THUNK | reserved | --|--> | I# | 5 |
+-------+----------+----+ +----+---+
1 1 1 1 1
deepseq it +-------+----------+----+ +----+---+
| IND | | --|--> | I# | 5 |
+-------+-----|----+----+ +----+---+
| 1 1
`------------> +----+---+
| I# | 6 |
+----+---+
1 1
GC +----+---+
| I# | 6 |
+----+---+
So haven't we allocated 5 bytes, not two? Three for the GC'd thunk, and two
for the new Int?
Any clarification or pointers (heh) to some GHC reading would be greatly
appreciated!
Thanks,
Mitchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From iavor.diatchki at gmail.com Wed Aug 3 20:41:28 2016
From: iavor.diatchki at gmail.com (Iavor Diatchki)
Date: Wed, 3 Aug 2016 13:41:28 -0700
Subject: [Haskell-cafe] [Job] Formal Tech is hiring
Message-ID:
Hello,
Formal Tech, a Galois spin-off, is looking for a mid to senior level
engineer to work on CyberChaff (
https://formal.tech/products/cyberchaff/). Applicants should be
proficient in Haskell and at least one other programming language. This is
a full time position with benefits. If you are interested, please send your
resume to careers at formal.tech
Cheers,
-Iavor
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ch.howard at zoho.com Thu Aug 4 01:51:01 2016
From: ch.howard at zoho.com (Christopher Howard)
Date: Wed, 3 Aug 2016 17:51:01 -0800
Subject: [Haskell-cafe] memory usage: general questions
In-Reply-To: <76e26246-fa8a-b281-18da-95fb403f5f7d@tu-harburg.de>
References: <57A1790C.1010104@zoho.com>
<76e26246-fa8a-b281-18da-95fb403f5f7d@tu-harburg.de>
Message-ID: <57A29F85.8060100@zoho.com>
On 08/03/2016 12:06 AM, Jonas Scholl wrote:
>>
>> 3) Are the "overwritten" portions of each B (i.e., those parts of the
>> persistent data we no are no longer needed) guaranteed to be pushed out
>> of memory at any particular point? Is this something we know will
>> (might?) happen as soon as the GC is run? Or does it happen right when
>> each f is applied to it's argument?
>>
>
> Nothing is overwritten. Instead, a new version of B is allocated and the
> old one is collected after the last reference is dropped. Maybe this is
> best visible if you consider (f b, g b). Overwriting parts of b in f
> would change the argument to g. Thus, a copy has to be produced. It
> would be valid if the compiler could prove that only one reference
> exists and this is passed to f, but first this proof could be difficult
> and second a separate version of f would have to be compiled. This may
> even reduce performance, as the GC is exploiting the fact that most data
> structures are immutable (although thunks are mutable as they are
> overwritten by their result). Thus, such an optimization could hurt the
> GC, which would result in a global slowdown, further reducing any gains
> from overwriting the contents of the argument. Additionally, GCs are
> quite cheep if not much data is alive.
>
>
Thank you for the thorough and interesting response to my first two
questions. I am hoping I might get additional clarification on this
third question.
Please forgive the use of the term "overwritten". Of course, the data
structures are immutable. However, I was of the understanding that,
through the use of persistent data structures, it was not necessary for
the entire data structure to copied, if only part of the structure changes.
Suppose I have a list data structure possessing millions of nodes and
occupying 100MB of memory. And then suppose that the update function
"drops" (speaking metaphorically!) two nodes off the front of the
original list, and then prepends a new node to the front of that. Most
of the original listed can be reused, since the new list can simply
point to it after the first node. But what about those two nodes that
were "dropped" from the list, and never used by anything else in the
program. My question was: will they immediately be deallocated in memory
right after the application of the update function? Or are they cleaned
up later by the GC? And can we be sure that it will be on the next run
of the GC, or could they be hanging around it memory for a while,
depending on other factors?
--
https://qlfiles.net
To protect my privacy, please use PGP encryption. It's free and easy
to use! My public key ID is 0x340EA95A (pgp.mit.edu).
From harendra.kumar at gmail.com Thu Aug 4 02:00:43 2016
From: harendra.kumar at gmail.com (Harendra Kumar)
Date: Thu, 4 Aug 2016 07:30:43 +0530
Subject: [Haskell-cafe] ANN: unicode-transforms-0.1.0.1 (unicode
normalization)
Message-ID:
This is for those who want unicode normalization but do not want a
dependency on the heavyweight icu libraries. It has the same API as the
text-icu package. It is based on the utf8proc C implementation.
https://hackage.haskell.org/package/unicode-transforms
https://github.com/harendra-kumar/unicode-transforms
A pure Haskell implementation is a work in progress, it works for the NFD
normalization form as of now. I could make it perform better than the
current utf8proc C implementation and it even beats the ICU implementation
in one of the benchmarks. I intend to finish it when I find time to work on
it again. Contributions are welcome!
-harendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From ok at cs.otago.ac.nz Thu Aug 4 02:45:49 2016
From: ok at cs.otago.ac.nz (Richard A. O'Keefe)
Date: Thu, 4 Aug 2016 14:45:49 +1200
Subject: [Haskell-cafe] memory usage: general questions
In-Reply-To: <57A29F85.8060100@zoho.com>
References: <57A1790C.1010104@zoho.com>
<76e26246-fa8a-b281-18da-95fb403f5f7d@tu-harburg.de>
<57A29F85.8060100@zoho.com>
Message-ID:
On 4/08/16 1:51 PM, Christopher Howard wrote:
> Please forgive the use of the term "overwritten". Of course, the data
> structures are immutable. However, I was of the understanding that,
> through the use of persistent data structures, it was not necessary for
> the entire data structure to copied, if only part of the structure changes.
>
> Suppose I have a list data structure possessing millions of nodes and
> occupying 100MB of memory. And then suppose that the update function
> "drops" (speaking metaphorically!) two nodes off the front of the
> original list, and then prepends a new node to the front of that. Most
> of the original listed can be reused, since the new list can simply
> point to it after the first node. But what about those two nodes that
> were "dropped" from the list, and never used by anything else in the
> program. My question was: will they immediately be deallocated in memory
> right after the application of the update function?
You can't tell. It depends on the implementation and the language.
There is a Haskell-like language called Clean in which
f :: (*x *x -> *x) *[!x!] -> *[!x!]
f g [! x : [! y : zs !]!] = [g x y : zs]
([!x!] is both value and spine strict; [ _ : _ ] is cons, *t means unique)
would allow the compiler to cannibalise one of the "dropped" nodes
for the new node. Which if any versions of the Clean compiler actually
do this I can't recall; I believe the 1.x compilers didn't but maybe 2.x
ones do.
This relies on the "uniqueness types" of Clean. Haskell is more
interested in
larger-scale improvements like deforestation.
> Or are they cleaned up later by the GC?
Modulo hand waving, yes.
> And can we be sure that it will be on the next run
> of the GC,
What does that even mean? When you have "generational" collectors
possibly using different strategies in different generations? When you
have incremental collectors? When you have concurrent collectors?
before the collector
> or could they be hanging around it memory for a while,
> depending on other factors?
Well, when "the" garbage collector "runs" depends on other factors,
so those are not exclusive alternatives.
If you think about traditional reference counting (which is not a silly
thing to do in a Haskell context, because there are some truly
impressive hybrid reference counting GCs these days), lazy decrementing
meant that if a chunk of data became garbage, *part* of it could be
reclaimed promptly, but the contents would only incremently be freed as
a side effect of allocation.
Memory management is a complex business, and depending on exactly
what a language's run-time does is risky.
>
From maydwell at gmail.com Thu Aug 4 06:13:11 2016
From: maydwell at gmail.com (Lyndon Maydwell)
Date: Thu, 4 Aug 2016 16:13:11 +1000
Subject: [Haskell-cafe] [ANN] Compose :: Melbourne 2016 Speakers!
Message-ID:
Hello Everyone!
In case you haven't heard, Compose :: Melbourne (the new sister-conference
of Compose) has now announced its program of presentations for the first
day:
http://www.composeconference.org/2016-melbourne/day-one-program/
Compose is a conference for functional programmers, focused on technologies
such as Haskell, Scala, Clojure, OCaml, F#, SML and others. Compose ::
Melbourne will run on the 29th and 30th of August (this month!)
We're excited to have a wide range of talks on a diverse selection of
topics including an opening keynote by Manuel M.T. Chakravarty (the author
of Haskell for Mac). There will be a single track of 10 speakers from
Melbourne, Australia, and around the world!
## Unconference and Workshops
The second day of the conference will take the form of an unconference. The
day will also feature a collection of organised, as well as spontaneous
workshops including introductions to Haskell and Purescript:
http://www.composeconference.org/2016-melbourne/unconference/
## Financial Assistance
If you need help attending Compose :: Melbourne, then contact us. We have
put in place a financial-assistance plan:
http://www.composeconference.org/2016-melbourne/assistance/
## Volunteering
As Compose :: Melbourne will be running in just a few short weeks, we're
currently looking for volunteers to help assist with running the workshops
on day-two. If you feel like lending a hand, then don't hesitate to get in
touch!
## Sponsorship
If you, or your organisation wishes to lend assistance to Compose ::
Melbourne, we are accepting sponsorship. If you want to learn more, then
please view our sponsorship-prospectus:
https://github.com/composeconference/Compose-Melbourne/wiki/Sponsorship-Tiers
## Getting in Touch
To get in touch with the organisers of Compose :: Melbourne, then email the
committee at .
For more information, see the home-page of Compose Conference:
http://www.composeconference.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From heraldhoi at gmail.com Thu Aug 4 07:36:35 2016
From: heraldhoi at gmail.com (Geraldus)
Date: Thu, 04 Aug 2016 07:36:35 +0000
Subject: [Haskell-cafe] Design Question - Functions taking 'subtype'
like arguments but has to be restricted to one type
In-Reply-To:
References: <8ed829cc-3f7b-407d-a1cb-fd66785ac60a@googlegroups.com>
<614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
Message-ID:
Please excuse me an off-topic question, *MarLinn* can you say what
apostrophe means in `Item 'Changeable`?
ср, 3 авг. 2016 г. в 20:00, MarLinn via Haskell-Cafe <
haskell-cafe at haskell.org>:
> I'll try to address the questions in the reverse order.
>
>
> Does this approach give me any more power than the previous approaches?
> The one power is that we stop the user from being able to construct the
> Frozen type, and we leave it to the compiler to return that type based on
> the inference. Correct? Is there any other power.
>
> The main power lies in the minimalism. You don't need special handling of
> an *Either* or manual tracking because the types do everything you need.
>
>
> In your approach or in the approach suggested by others, ultimately, I end
> up handling the 'Frozen' type during run-time.
>
> Actually, not really. That's the beauty of phantom types: It's almost
> exclusively a development-time tool that vanishes once the program is
> compiled. You can't handle the Frozen type during run-time because it will
> have been dropped - unless you use tricks to keep it, of course. It might
> feel like you're dealing with the type, but it's all in your head.
>
>
> There is no way from stopping somene write code that calls update's on
> Frozen. (For example while mapping..). Is that understanding correct?
>
> Here's my *Item* type again for reference:
>
> data Item (c :: Changeability) = Item { plainItem :: PlainItem }
>
> If you don't export the *Item* constructor, you have full control over
> who gets to do what with your items. If your only exported update function
> is
>
> changeItem :: (PlainItem -> PlainItem) -> Item 'Changeable -> Item 'Changeable
>
> then only non-frozen items can be changed, as the type signature says. Of
> course you have to be careful, e.g. you wouldn't want to export a function
> like
>
> asChangableItem :: PlainItem -> Item 'Changeable
>
> because then somebody could "unfreeze" items. But as long as you watch
> your types and exports, you should be fine. (apart from unsafe casting and
> the like, naturally)
>
> 1. With the definition of Basket c, how do I create a type such as
>
> Cart = [Basket]. The only way to create such a cart is Cart c = [Basket
> c]. But, that ties the Cart to one definition of Basket. Is there a way
> around this? I might be missing something simple.
>
> That depends. How does a cart behave, depending on the changeability of
> its contents?
>
> -
>
> *If a cart with any frozen value behaves differently from a cart with
> only changeable baskets* then add a phantom type to the cart as well.
> Control the channels into it and have the cart type change depending on
> what you insert.
> -
>
> *If all carts behave the same and contents don't matter* just store
> *PlainBasket*s, i.e. a *Basket* without the annotation.
> -
>
> *If you want to be able to map over baskets in a cart while handling
> frozen ones** differently*, then you need both run-time information
> about basket changeability and a way to share functions between the two
> different types. The canonical way to share a function between types is a
> class:
>
> class IsBasket b
> instance IsBasket (Basket c)
> type Cart = (IsBasket b) => [b] -- not a good definition, but you get the point
>
> Now *Basket*s can share functions but behave differently. Of course
> once you need such a class anyway you could ask why you would not want to
> use it exclusively instead of the phantom types. It's a matter of taste, I
> guess.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From hesselink at gmail.com Thu Aug 4 07:40:26 2016
From: hesselink at gmail.com (Erik Hesselink)
Date: Thu, 4 Aug 2016 09:40:26 +0200
Subject: [Haskell-cafe] Design Question - Functions taking 'subtype'
like arguments but has to be restricted to one type
In-Reply-To:
References: <8ed829cc-3f7b-407d-a1cb-fd66785ac60a@googlegroups.com>
<614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
Message-ID:
It's a data constructor promoted to be a type. Similarly the type can
be promoted to become a kind. See also [1].
Erik
[1] https://downloads.haskell.org/~ghc/7.10.3/docs/html/users_guide/promotion.html
On 4 August 2016 at 09:36, Geraldus wrote:
> Please excuse me an off-topic question, MarLinn can you say what apostrophe
> means in `Item 'Changeable`?
>
> ср, 3 авг. 2016 г. в 20:00, MarLinn via Haskell-Cafe
> :
>>
>> I'll try to address the questions in the reverse order.
>>
>>
>> Does this approach give me any more power than the previous approaches?
>> The one power is that we stop the user from being able to construct the
>> Frozen type, and we leave it to the compiler to return that type based on
>> the inference. Correct? Is there any other power.
>>
>> The main power lies in the minimalism. You don't need special handling of
>> an Either or manual tracking because the types do everything you need.
>>
>>
>> In your approach or in the approach suggested by others, ultimately, I end
>> up handling the 'Frozen' type during run-time.
>>
>> Actually, not really. That's the beauty of phantom types: It's almost
>> exclusively a development-time tool that vanishes once the program is
>> compiled. You can't handle the Frozen type during run-time because it will
>> have been dropped - unless you use tricks to keep it, of course. It might
>> feel like you're dealing with the type, but it's all in your head.
>>
>>
>> There is no way from stopping somene write code that calls update's on
>> Frozen. (For example while mapping..). Is that understanding correct?
>>
>> Here's my Item type again for reference:
>>
>> data Item (c :: Changeability) = Item { plainItem :: PlainItem }
>>
>> If you don't export the Item constructor, you have full control over who
>> gets to do what with your items. If your only exported update function is
>>
>> changeItem :: (PlainItem -> PlainItem) -> Item 'Changeable -> Item
>> 'Changeable
>>
>> then only non-frozen items can be changed, as the type signature says. Of
>> course you have to be careful, e.g. you wouldn't want to export a function
>> like
>>
>> asChangableItem :: PlainItem -> Item 'Changeable
>>
>> because then somebody could "unfreeze" items. But as long as you watch
>> your types and exports, you should be fine. (apart from unsafe casting and
>> the like, naturally)
>>
>>
>> 1. With the definition of Basket c, how do I create a type such as
>>
>> Cart = [Basket]. The only way to create such a cart is Cart c = [Basket
>> c]. But, that ties the Cart to one definition of Basket. Is there a way
>> around this? I might be missing something simple.
>>
>> That depends. How does a cart behave, depending on the changeability of
>> its contents?
>>
>> If a cart with any frozen value behaves differently from a cart with only
>> changeable baskets then add a phantom type to the cart as well. Control the
>> channels into it and have the cart type change depending on what you insert.
>>
>> If all carts behave the same and contents don't matter just store
>> PlainBaskets, i.e. a Basket without the annotation.
>>
>> If you want to be able to map over baskets in a cart while handling frozen
>> ones differently, then you need both run-time information about basket
>> changeability and a way to share functions between the two different types.
>> The canonical way to share a function between types is a class:
>>
>> class IsBasket b
>> instance IsBasket (Basket c)
>> type Cart = (IsBasket b) => [b] -- not a good definition, but you get
>> the point
>>
>> Now Baskets can share functions but behave differently. Of course once you
>> need such a class anyway you could ask why you would not want to use it
>> exclusively instead of the phantom types. It's a matter of taste, I guess.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From corentin.dupont at gmail.com Thu Aug 4 10:16:51 2016
From: corentin.dupont at gmail.com (Corentin Dupont)
Date: Thu, 4 Aug 2016 12:16:51 +0200
Subject: [Haskell-cafe] Views of data types
Message-ID:
Hi guys,
I have a typeclass like that:
class Signal s where
type SignalData s :: *
The idea is that when some signal "s" fires, it returns a data of type
(SignalData s).
This is all fine except when I instantiate the class with:
data Input a = Input [(a, String)]
instance Signal (Input a)
type SignalData (Input a) = a
The concrete type of Input a is not known, so its difficult to store in
lists, to serialize...
So I need to create a "view" for the it:
class (Signal s, Signal v) => SignalView s v where
view :: s -> v
data InputView = InputView [(Int, String)]
instance Signal InputView
type SignalData InputView = Int
instance SignalView (Input a) InputView
view (Input as) = InputView (zip [0…] (snd as))
Is this a common pattern?
I'm not sure I get it right...
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Aug 4 11:23:19 2016
From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis)
Date: Thu, 4 Aug 2016 12:23:19 +0100
Subject: [Haskell-cafe] Views of data types
In-Reply-To:
References:
Message-ID: <20160804112319.GE18591@weber>
On Thu, Aug 04, 2016 at 12:16:51PM +0200, Corentin Dupont wrote:
> class Signal s where
> type SignalData s :: *
>
> The idea is that when some signal "s" fires, it returns a data of type
> (SignalData s). This is all fine except when I instantiate the class
> with:
>
> data Input a = Input [(a, String)]
>
> instance Signal (Input a)
> type SignalData (Input a) = a
>
> The concrete type of Input a is not known, so its difficult to store in
> lists, to serialize... So I need to create a "view" for the it:
>
> class (Signal s, Signal v) => SignalView s v where
> view :: s -> v
>
> data InputView = InputView [(Int, String)]
>
> instance Signal InputView
> type SignalData InputView = Int
>
> instance SignalView (Input a) InputView
> view (Input as) = InputView (zip [0…] (snd as))
>
> Is this a common pattern?
> I'm not sure I get it right...
Why not just write a function 'Input a -> Input Int' and serialise the
result?
From info at jonkri.org Thu Aug 4 20:15:06 2016
From: info at jonkri.org (Jon Kristensen)
Date: Thu, 4 Aug 2016 22:15:06 +0200
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
Message-ID: <6018c63e-b60f-6002-ed22-c46276056d9e@jonkri.org>
Hi, everyone!
I'm looking for a master thesis topic that is empirical in nature (like,
statistics, hypothesis testing, etc.).
The work could involve analyzing either package metadata (Cabal
information), code (AST), and/or data from some other source, possibly
comparing similar data from some non-Haskell domain.
As an example, one idea that was suggested to me was to look at usage
aggregation, or like, how much of a given package another package is
actually using (which could be relevant in any orphan-instance discussion).
From an academic standpoint, it would be good to pick a metric that can
be validated in some way.
Thank you!
Best,
Jon
From msuzen at gmail.com Fri Aug 5 12:28:39 2016
From: msuzen at gmail.com (Suzen, Mehmet)
Date: Fri, 5 Aug 2016 13:28:39 +0100
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
In-Reply-To: <6018c63e-b60f-6002-ed22-c46276056d9e@jonkri.org>
References: <6018c63e-b60f-6002-ed22-c46276056d9e@jonkri.org>
Message-ID:
Jon,
Why don't you do some graph analysis on the entire hackage using the
metadata? Build a graph and analyse its statistical properties.
Best,
-m
On 4 August 2016 at 21:15, Jon Kristensen wrote:
> Hi, everyone!
>
> I'm looking for a master thesis topic that is empirical in nature (like,
> statistics, hypothesis testing, etc.).
>
> The work could involve analyzing either package metadata (Cabal
> information), code (AST), and/or data from some other source, possibly
> comparing similar data from some non-Haskell domain.
>
> As an example, one idea that was suggested to me was to look at usage
> aggregation, or like, how much of a given package another package is
> actually using (which could be relevant in any orphan-instance discussion).
>
> From an academic standpoint, it would be good to pick a metric that can be
> validated in some way.
>
> Thank you!
>
> Best,
> Jon
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From ruben.astud at gmail.com Fri Aug 5 18:49:21 2016
From: ruben.astud at gmail.com (Ruben Astudillo)
Date: Fri, 5 Aug 2016 14:49:21 -0400
Subject: [Haskell-cafe] a wiki in yesod package
Message-ID: <0fa6956b-0432-c923-9bc9-159a95787990@gmail.com>
Hi all
I've been looking for a package or helpful material to do a wiki based on
yesod. I seen the example on the book[1] and thought maybe somebody
published something.
by the way: which is the mailing list of yesod? the haskell-web is really
silent.
[1]: http://www.yesodweb.com/book/wiki-chat-example
--
-- Ruben Astudillo
From gurudev.devanla at gmail.com Sat Aug 6 03:39:45 2016
From: gurudev.devanla at gmail.com (Guru Devanla)
Date: Fri, 5 Aug 2016 20:39:45 -0700
Subject: [Haskell-cafe] Design Question - Functions taking 'subtype'
like arguments but has to be restricted to one type
In-Reply-To:
References: <8ed829cc-3f7b-407d-a1cb-fd66785ac60a@googlegroups.com>
<614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
Message-ID:
On Wed, Aug 3, 2016 at 7:58 AM, MarLinn via Haskell-Cafe <
haskell-cafe at haskell.org> wrote:
> *If all carts behave the same and contents don't matter* just store
> *PlainBasket*s, i.e. a *Basket* without the annotation.
@MarLinn, Can you clarify the quoted statement. If I were to make store
PlainBaskets in the Cart, where would be annotating the Item as
Changeble/Unchangable? The way I understand this, you will have to pass
their phatom type all the way from the top to the innermost field where it
is required.
Would the design still hold, if we just declare Baskets of Plain types?
I appreciate your response, so far your design make sense. But, I am afraid
I am not able to extend it to higher container types.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From info at jonkri.org Sat Aug 6 11:16:23 2016
From: info at jonkri.org (Jon Kristensen)
Date: Sat, 6 Aug 2016 13:16:23 +0200
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
In-Reply-To:
References: <6018c63e-b60f-6002-ed22-c46276056d9e@jonkri.org>
Message-ID:
Hi, Mehmet!
Thank you for your suggestion!
I think that I will need to describe some concrete goals, and provide
some evidence from literature that the area includes, or is related to,
particular scientific and engineering challenges. I will take a look at
related papers about this, but any thoughts on it would be welcome!
Best,
Jon
On 08/05/2016 02:28 PM, Suzen, Mehmet wrote:
> Jon,
>
> Why don't you do some graph analysis on the entire hackage using the
> metadata? Build a graph and analyse its statistical properties.
>
> Best,
> -m
>
> On 4 August 2016 at 21:15, Jon Kristensen wrote:
>> Hi, everyone!
>>
>> I'm looking for a master thesis topic that is empirical in nature (like,
>> statistics, hypothesis testing, etc.).
>>
>> The work could involve analyzing either package metadata (Cabal
>> information), code (AST), and/or data from some other source, possibly
>> comparing similar data from some non-Haskell domain.
>>
>> As an example, one idea that was suggested to me was to look at usage
>> aggregation, or like, how much of a given package another package is
>> actually using (which could be relevant in any orphan-instance discussion).
>>
>> From an academic standpoint, it would be good to pick a metric that can be
>> validated in some way.
>>
>> Thank you!
>>
>> Best,
>> Jon
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
From damian.nadales at gmail.com Sat Aug 6 11:37:20 2016
From: damian.nadales at gmail.com (Damian Nadales)
Date: Sat, 6 Aug 2016 13:37:20 +0200
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
In-Reply-To: <6018c63e-b60f-6002-ed22-c46276056d9e@jonkri.org>
References: <6018c63e-b60f-6002-ed22-c46276056d9e@jonkri.org>
Message-ID:
Hi Jon,
Allow me to brainstorm with you. I don't know what is done in the context
of code metrics for Haskell programs, but you could try to find
correlations (of their lack thereof) between metrics such as (cyclomatic
complexity, fan-in/fan-out) and bugs. For this you could use the Github
repositories. The number of bugs would have to be normalized using the
numbers of users of a project (maybe measured in number of downloads).
Just an idea...
On Thu, Aug 4, 2016 at 10:15 PM, Jon Kristensen wrote:
> Hi, everyone!
>
> I'm looking for a master thesis topic that is empirical in nature (like,
> statistics, hypothesis testing, etc.).
>
> The work could involve analyzing either package metadata (Cabal
> information), code (AST), and/or data from some other source, possibly
> comparing similar data from some non-Haskell domain.
>
> As an example, one idea that was suggested to me was to look at usage
> aggregation, or like, how much of a given package another package is
> actually using (which could be relevant in any orphan-instance discussion).
>
> From an academic standpoint, it would be good to pick a metric that can be
> validated in some way.
>
> Thank you!
>
> Best,
> Jon
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From monkleyon at googlemail.com Sat Aug 6 14:23:00 2016
From: monkleyon at googlemail.com (MarLinn)
Date: Sat, 6 Aug 2016 16:23:00 +0200
Subject: [Haskell-cafe] Design Question - Functions taking 'subtype'
like arguments but has to be restricted to one type
In-Reply-To:
References: <8ed829cc-3f7b-407d-a1cb-fd66785ac60a@googlegroups.com>
<614e9096-57a1-21da-7e75-a0ffc8d977cf@gmail.com>
Message-ID: <73a5a0ed-cd0a-a84b-416a-e134329a01d5@gmail.com>
> /If all carts behave the same and contents don't matter/ just
> store /PlainBasket/s, i.e. a /Basket/ without the annotation.
>
> Can you clarify the quoted statement. If I were to make store
> PlainBaskets in the Cart, where would be annotating the Item as
> Changeble/Unchangable?
Well /contents don't matter, /so there is no annotation once you enter a
cart.
-- A/PlainBasket/ is to a/Basket/ as a/PlainItem/ is to an/Item./
data PlainBasket = PlainBasket { plainBasketName :: String, plainBasketItem :: PlainItem }
data Basket c = Basket { basketName :: String, basketItem :: Item c }
newtype Cart = Cart [PlainBasket]
addBasketToCart :: Basket c -> Cart -> Cart
addBasketToCart Basket{..} (Cart cart) = Cart $ newPlainBasket:cart
where newPlainBasket = PlainBasket { plainBasketName = basketName
, plainBasketItem = plainItem basketItem
}
The newtype protects your cart from arbitrary changes, so frozen baskets
are still protected. But the annotations are discarded. So naturally,
you can not recover changeability and you shouldn't allow arbitrary
mapping. If you need one of these, this is not the right option. It
really depends on what you actually need.
Of course you could add a changeability field to /PlainBasket/s and thus
store the information at runtime again. But Theodores /Either/-approach
or variations of the class I propose in my the third option are more
elegant forms of that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From borgauf at gmail.com Sat Aug 6 20:53:18 2016
From: borgauf at gmail.com (Lawrence Bottorff)
Date: Sat, 6 Aug 2016 16:53:18 -0400
Subject: [Haskell-cafe] Comparable Haskell text(s) to "ML for the Working
Programmer"?
Message-ID:
Is there a book or books that cover as much, as well as the Lawrence
Paulson "ML for the Working Programmer (2nd ed)" for Haskell? What I'd like
in Haskell form is pretty much exactly what Paulson covers in his brilliant
book.
LB
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From damian.only at gmail.com Sat Aug 6 21:11:27 2016
From: damian.only at gmail.com (Damian)
Date: Sat, 6 Aug 2016 23:11:27 +0200
Subject: [Haskell-cafe] Comparable Haskell text(s) to "ML for the
Working Programmer"?
In-Reply-To:
References:
Message-ID:
Can you enumerate which features you liked about that book, and which
topics it covered?
Op 6 aug. 2016 22:53 schreef "Lawrence Bottorff" :
> Is there a book or books that cover as much, as well as the Lawrence
> Paulson "ML for the Working Programmer (2nd ed)" for Haskell? What I'd like
> in Haskell form is pretty much exactly what Paulson covers in his brilliant
> book.
>
> LB
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From targen at gmail.com Sat Aug 6 21:11:34 2016
From: targen at gmail.com (=?UTF-8?Q?Manuel_G=C3=B3mez?=)
Date: Sat, 6 Aug 2016 17:11:34 -0400
Subject: [Haskell-cafe] a wiki in yesod package
In-Reply-To: <0fa6956b-0432-c923-9bc9-159a95787990@gmail.com>
References: <0fa6956b-0432-c923-9bc9-159a95787990@gmail.com>
Message-ID:
On Fri, Aug 5, 2016 at 2:49 PM, Ruben Astudillo wrote:
> by the way: which is the mailing list of yesod? the haskell-web is really
> silent.
Try here: https://groups.google.com/d/forum/yesodweb
From stephen.tetley at gmail.com Sat Aug 6 21:35:48 2016
From: stephen.tetley at gmail.com (Stephen Tetley)
Date: Sat, 6 Aug 2016 22:35:48 +0100
Subject: [Haskell-cafe] Comparable Haskell text(s) to "ML for the
Working Programmer"?
In-Reply-To:
References:
Message-ID:
ML for the Working Programmer is roughly equivalent of SICP but uses
SML instead of Scheme. It also covers most (?) of the SML language
whereas SICP is not really a book about (MIT-) Scheme.
The closest Haskell equivalent might be the second edition of Graham
Hutton's Programming in Haskell from what I've seen of the press
release and table of contents. The first edition was very much a short
and readable introduction to functional programming in Haskell (not
covering all of the Haskell language). It looks the second edition
takes a significantly deeper look at Haskell the language.
On 6 August 2016 at 22:11, Damian wrote:
> Can you enumerate which features you liked about that book, and which
> topics it covered?
>
>
> Op 6 aug. 2016 22:53 schreef "Lawrence Bottorff" :
>>
>> Is there a book or books that cover as much, as well as the Lawrence
>> Paulson "ML for the Working Programmer (2nd ed)" for Haskell? What I'd like
>> in Haskell form is pretty much exactly what Paulson covers in his brilliant
>> book.
>>
>> LB
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From doug at cs.dartmouth.edu Sat Aug 6 23:15:49 2016
From: doug at cs.dartmouth.edu (Doug McIlroy)
Date: Sat, 06 Aug 2016 19:15:49 -0400
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
Message-ID: <201608062315.u76NFnHt016926@coolidge.cs.Dartmouth.EDU>
>
>The number of bugs would have to be normalized using the
numbers of users of a project (maybe measured in number of downloads).
From doug at cs.dartmouth.edu Sat Aug 6 23:22:13 2016
From: doug at cs.dartmouth.edu (Doug McIlroy)
Date: Sat, 06 Aug 2016 19:22:13 -0400
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
Message-ID: <201608062322.u76NMDai016935@coolidge.cs.Dartmouth.EDU>
>The number of bugs would have to be normalized using the
numbers of users of a project (maybe measured in number of downloads).
Do you expect more bugs for frequently downloaded packages,
or fewer downloads for packages with many bug reports
or bug rate diminishing with downloads? It's a slippery
topic.
Doug
From damian.nadales at gmail.com Sun Aug 7 07:06:31 2016
From: damian.nadales at gmail.com (Damian Nadales)
Date: Sun, 7 Aug 2016 09:06:31 +0200
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
In-Reply-To: <201608062322.u76NMDai016935@coolidge.cs.Dartmouth.EDU>
References: <201608062322.u76NMDai016935@coolidge.cs.Dartmouth.EDU>
Message-ID:
On Sun, Aug 7, 2016 at 1:22 AM, Doug McIlroy wrote:
>
>
> >The number of bugs would have to be normalized using the
> numbers of users of a project (maybe measured in number of downloads).
>
> Do you expect more bugs for frequently downloaded packages,
> or fewer downloads for packages with many bug reports
> or bug rate diminishing with downloads? It's a slippery
> topic.
>
The question is whether code metrics could serve as a proxy for
code-quality/sustainability. I didn't suggest to look for associations
between downloads and bug-reports, but use the number of users as an
extra variable in the model (to normalize the data). So if we assume
that all the other variables remain the same, does code with better
metrics exhibit better quality features in practice?
>
> Doug
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From adam at bergmark.nl Sun Aug 7 12:42:59 2016
From: adam at bergmark.nl (Adam Bergmark)
Date: Sun, 7 Aug 2016 14:42:59 +0200
Subject: [Haskell-cafe] [ANN] aeson 1.0.0.0
Message-ID:
Hi haskellers,
I'm happy to announce that aeson v1.0.0.0 is now available on hackage!
While 0.11.x was mostly regression fixes 1.x adds a lot of
improvements that had been in the pipeline for a long time.
We decided to move to 1.x since there are a lot of
changes. Fortunately most of them are backwards-compatible so
hopefully migration will be simple for you. Still, we recommend reading
the
changelog (https://github.com/bos/aeson/blob/master/changelog.md#1000)
Thanks to all contributors of this release:
* Adam Bergmark
* Andrew Martin
* Artyom
* Ewout
* Matthías Páll Gissurarson
* Oleg Grenrus
* Ryan Scott
* lyxia
Regards,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From danburton.email at gmail.com Sun Aug 7 19:20:09 2016
From: danburton.email at gmail.com (Dan Burton)
Date: Sun, 7 Aug 2016 12:20:09 -0700
Subject: [Haskell-cafe] [ANN] aeson 1.0.0.0
In-Reply-To:
References:
Message-ID:
Congrats on the release! It's always nice to see libraries move past
version 0.*.
-- Dan Burton
On Sun, Aug 7, 2016 at 5:42 AM, Adam Bergmark wrote:
> Hi haskellers,
>
> I'm happy to announce that aeson v1.0.0.0 is now available on hackage!
>
> While 0.11.x was mostly regression fixes 1.x adds a lot of
> improvements that had been in the pipeline for a long time.
>
> We decided to move to 1.x since there are a lot of
> changes. Fortunately most of them are backwards-compatible so
> hopefully migration will be simple for you. Still, we recommend reading
> the
> changelog (https://github.com/bos/aeson/blob/master/changelog.md#1000)
>
> Thanks to all contributors of this release:
> * Adam Bergmark
> * Andrew Martin
> * Artyom
> * Ewout
> * Matthías Páll Gissurarson
> * Oleg Grenrus
> * Ryan Scott
> * lyxia
>
> Regards,
> Adam
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From info at jonkri.org Mon Aug 8 11:59:03 2016
From: info at jonkri.org (Jon Kristensen)
Date: Mon, 8 Aug 2016 13:59:03 +0200
Subject: [Haskell-cafe] Suggestions for an empirical master thesis
In-Reply-To:
References: <201608062322.u76NMDai016935@coolidge.cs.Dartmouth.EDU>
Message-ID:
That's interesting! Thank you very much!
Best,
Jon
On 08/07/2016 09:06 AM, Damian Nadales wrote:
> On Sun, Aug 7, 2016 at 1:22 AM, Doug McIlroy wrote:
>>
>>> The number of bugs would have to be normalized using the
>> numbers of users of a project (maybe measured in number of downloads).
>>
>> Do you expect more bugs for frequently downloaded packages,
>> or fewer downloads for packages with many bug reports
>> or bug rate diminishing with downloads? It's a slippery
>> topic.
>>
> The question is whether code metrics could serve as a proxy for
> code-quality/sustainability. I didn't suggest to look for associations
> between downloads and bug-reports, but use the number of users as an
> extra variable in the model (to normalize the data). So if we assume
> that all the other variables remain the same, does code with better
> metrics exhibit better quality features in practice?
>
>
>> Doug
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From code at funwithsoftware.org Tue Aug 9 15:04:56 2016
From: code at funwithsoftware.org (Patrick Pelletier)
Date: Tue, 9 Aug 2016 08:04:56 -0700
Subject: [Haskell-cafe] [ANN] normalization-insensitive-2.0
Message-ID:
normalization-insensitive is identical to case-insensitive, except it is
insensitive to Unicode normalization, rather than case. The module
Data.Unicode.NormalizationInsensitive provides the NI type constructor
which can be parameterized by a string-like type like: String,
ByteString, Text, etc.. Comparisons of values of the resulting type
will be insensitive to normalization.
https://hackage.haskell.org/package/normalization-insensitive
https://github.com/ppelleti/normalization-insensitive
I created this to solve a problem I was running into comparing filenames
on Mac OS X. Because Mac OS X converts all filenames to Normalization
Form D, the filenames I read back from disk were different than the
filenames I had written to disk. This package solved the problem very
neatly.
Under the hood, normalization-insensitive uses the unicode-transforms
package, which Harendra Kumar announced a few days ago on haskell-cafe.
This avoids having to pull in any heavyweight dependencies like ICU.
Thanks to Bas van Dijk for writing case-insensitive, upon which
normalization-insensitive is based. And thanks for Harendra Kumar for
reviewing normalization-insensitive and providing feedback, as well as
writing unicode-transforms.
Although this is the first release of normalization-insensitive, the
version number is 2.0 to avoid any confusion with the version numbers of
case-insensitive.
--Patrick
From ollie at ocharles.org.uk Wed Aug 10 17:18:05 2016
From: ollie at ocharles.org.uk (Oliver Charles)
Date: Wed, 10 Aug 2016 17:18:05 +0000
Subject: [Haskell-cafe] C call blocking indefinitely/behaving differently
when called from Haskell
Message-ID:
Hi all,
I'm trying to interface with a Basler USB3 camera
from a Haskell application, but I'm
experiencing some difficulty. The camera comes with a C++ library that
makes it fairly straight forward. The following code can be used to acquire
a camera source:
PylonAutoInitTerm pylon;
CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice());
camera.RegisterConfiguration( (CConfigurationEventHandler*) NULL,
RegistrationMode_ReplaceAll, Cleanup_None);
cout << "Using device " << camera.GetDeviceInfo().GetModelName() <<
endl;
Using the inline-c and inline-c-cpp libraries, I am trying to perform this
same call from a Haskell executable. I have the following:
{-# LANGUAGE QuasiQuotes, TemplateHaskell #-}
import qualified Language.C.Inline as C
import qualified Language.C.Inline.Cpp as C
C.context C.cppCtx
C.include "pylon/PylonIncludes.h"
C.include "iostream"
C.using "namespace Pylon";
C.using "namespace std";
main :: IO ()
main =
[C.block| void {
PylonAutoInitTerm pylon;
CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice());
camera.RegisterConfiguration( (CConfigurationEventHandler*) NULL,
RegistrationMode_ReplaceAll, Cleanup_None);
cout << "Using device " << camera.GetDeviceInfo().GetModelName() <<
endl;
}|]
However, when the resulting executable is ran, it hangs - failing to print
"Using device".
inline-c generates a Test.cpp file, which contains
#include "pylon/PylonIncludes.h"
#include "iostream"
using namespace Pylon;
using namespace std;
extern "C" {
void inline_c_Main_0_e23f0c6a0bc10367be76252744bf4e6c74493314() {
PylonAutoInitTerm pylon;
CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice());
camera.RegisterConfiguration( (CConfigurationEventHandler*) NULL,
RegistrationMode_ReplaceAll, Cleanup_None);
cout << "Using device " << camera.GetDeviceInfo().GetModelName() <<
endl;
}
}
If I modify this exact file, I can turn it into something that can be run,
by simply adding:
int main() {
inline_c_Main_0_e23f0c6a0bc10367be76252744bf4e6c74493314();
}
At this point, I can now compile that very C++ code with G++ and run it:
[nix-shell:~/work/circuithub/receiving-station]$ g++ Test.cpp
-I/home/ollie/work/circuithub/receiving-station/pylon5/include
-L/home/ollie/work/circuithub/receiving-station/pylon5/lib64 -Wl,-E
-lpylonbase -lpylonu
tility -lGenApi_gcc_v3_0_Basler_pylon_v5_0
-lGCBase_gcc_v3_0_Basler_pylon_v5_0 -Wl,--enable-new-dtags
-Wl,-rpath,/home/ollie/work/circuithub/receiving-station/pylon5/lib64
[nix-shell:~/work/circuithub/receiving-station]$ ./a.out
GetDeviceDiscoveryInfo: bFunctionClass = 14, bFunctionSubClass = 3,
bFunctionProtocol = 0. Device is not an U3V device.
GetDeviceDiscoveryInfo: bFunctionClass = 14, bFunctionSubClass = 3,
bFunctionProtocol = 0. Device is not an U3V device.
Using device acA3800-14um
So as we can see, the C++ code is not the problem.
Does anyone know why I don't see the same behaviour from my Haskell
application? I imagine there might be some thread trickery happening behind
the scenes, but I don't know what to even begin looking for.
Thanks, let me know if you need any more information.
- Ollie
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From anthony_clayden at clear.net.nz Thu Aug 11 04:37:57 2016
From: anthony_clayden at clear.net.nz (=?UTF-8?B?QW50aG9ueSBDbGF5ZGVu?=)
Date: Thu, 11 Aug 2016 07:37:57 +0300
Subject: [Haskell-cafe] =?utf-8?q?library_for_set_of_heterogeneous_values?=
=?utf-8?q?=3F?=
Message-ID: <1470890276.638665871@f25.my.com>
I have a (let's call it) database of heterogeneous records.
They're not Haskell records, but anonymous/extensible type-labelled rows. (Could be tuples, could be HLists, could be Lens-like, could be something fancier.)
There's a small number (dozens) of distinct row types, each with a large number (thousands) of rows. The variety of row-types is not predictable in advance. And indeed a row might 'morph' over time with fields added/removed.
So the obvious answer of putting the lot into a giant HList (each element of the list being a row) isn't going to scale. I could have a type-indexed HList in which each element is a Set of homogeneous rows. But performance still suffers from scanning along the list to find the right type index.
Is there something better? On hackage there's two packages called HSet, neither giving very much help about their suitability:
* `hset` (lower case) [AlekseyUymanov] seems isomorphic to a type-indexed HList.
ie Must be unique type in each element (could be a Set type, I guess)
* `HSet` (upper case) [athanclark] "Faux heterogeneous sets" seems a lot meatier
why the "Faux"?
built over hashtables in the ST monad.
Has anybody used these? Can give guidance on what they can and can't?
Bonus questions:
Given a filter specifying a restriction on (some) fields of rows, I want to get a heterog subset:
* all rows with at least those fields, matching those restrictions.
* the restriction might be merely "has field labelled L".
GIven a candidate row for insertion, I want first to scan for quasi-duplicates:
* any existing row with a subset of the given fields, and the same value at those fields.
* any existing row with a superset of the given fields, and the same value at those fields in common.
* ignore records with only a partial overlap of fields.
One possible data structure: a "vertical store".
Give each row a Globally Unique Id.
Have a separate set for each possible field,
where the set elements are field value (key) to set of GUId -- records with that value.
Then I have a different bonus question:
* how to retrieve all field values for a given GUId?
Thanks
AntC
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jake.waksbaum at gmail.com Thu Aug 11 07:03:55 2016
From: jake.waksbaum at gmail.com (Jake)
Date: Thu, 11 Aug 2016 03:03:55 -0400
Subject: [Haskell-cafe] Read lines of a file into a Vector
In-Reply-To:
References:
Message-ID:
I want to write a function that will read the contents of a file and return
a Vector of its lines:
readLines :: Handle -> IO (Vector String)
I have an implementation that works but seems to naive and inefficient to
me because it reads the entire file contents, *then *splits it into lines,
and *then* converts it to a Vector from a list.
readLines h = fromList . lines hGetContents h
I would like to a) use hGetLine and continue until I get an isEOFError and
b) read directly into a Vector instead of a list. I started something using
Data.Vector.unfoldr but I the presence of the IO monad around my String was
causing issues I couldn't figure out how to solve.
I'd also be curious to see how to do either one of these things separately
and I assume they'd each help make my program more efficient on their own.
Or, maybe my implementation is not as terrible as I thought because some
laziness/fusion/optimization magic is happening behind the scenes?
Thanks,
Jake Waksbaum
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From oleg.grenrus at iki.fi Thu Aug 11 07:27:14 2016
From: oleg.grenrus at iki.fi (Oleg Grenrus)
Date: Thu, 11 Aug 2016 10:27:14 +0300
Subject: [Haskell-cafe] Read lines of a file into a Vector
In-Reply-To:
References:
Message-ID:
Thanks to the lazy IO, deforestration and fusion framework in `Vector`,
readLines h = fromList . lines hGetContents h
shouldn’t create intermediate lists or/and read the whole file at once into memory.
- Oleg
> On 11 Aug 2016, at 10:03, Jake wrote:
>
> I want to write a function that will read the contents of a file and return a Vector of its lines:
>
> readLines :: Handle -> IO (Vector String)
>
> I have an implementation that works but seems to naive and inefficient to me because it reads the entire file contents, then splits it into lines, and then converts it to a Vector from a list.
>
> readLines h = fromList . lines hGetContents h
>
> I would like to a) use hGetLine and continue until I get an isEOFError and b) read directly into a Vector instead of a list. I started something using Data.Vector.unfoldr but I the presence of the IO monad around my String was causing issues I couldn't figure out how to solve.
>
> I'd also be curious to see how to do either one of these things separately and I assume they'd each help make my program more efficient on their own. Or, maybe my implementation is not as terrible as I thought because some laziness/fusion/optimization magic is happening behind the scenes?
>
> Thanks,
> Jake Waksbaum
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL:
From tdammers at gmail.com Thu Aug 11 17:57:35 2016
From: tdammers at gmail.com (Tobias Dammers)
Date: Thu, 11 Aug 2016 19:57:35 +0200
Subject: [Haskell-cafe] Read lines of a file into a Vector
In-Reply-To:
References:
Message-ID:
If I'm not mistaken, lazy lists and lazy IO alone make this a reasonably
efficient implementation; even without further optimizations, the
intermediate lists would most likely never reside in memory all at once.
On Aug 11, 2016 9:27 AM, "Oleg Grenrus" wrote:
> Thanks to the lazy IO, deforestration and fusion framework in `Vector`,
>
> readLines h = fromList . lines hGetContents h
>
> shouldn’t create intermediate lists or/and read the whole file at once
> into memory.
>
> - Oleg
>
>
> On 11 Aug 2016, at 10:03, Jake wrote:
>
> I want to write a function that will read the contents of a file and
> return a Vector of its lines:
>
> readLines :: Handle -> IO (Vector String)
>
> I have an implementation that works but seems to naive and inefficient to
> me because it reads the entire file contents, *then *splits it into
> lines, and *then* converts it to a Vector from a list.
>
> readLines h = fromList . lines hGetContents h
>
> I would like to a) use hGetLine and continue until I get an isEOFError and
> b) read directly into a Vector instead of a list. I started something using
> Data.Vector.unfoldr but I the presence of the IO monad around my String was
> causing issues I couldn't figure out how to solve.
>
> I'd also be curious to see how to do either one of these things separately
> and I assume they'd each help make my program more efficient on their own.
> Or, maybe my implementation is not as terrible as I thought because some
> laziness/fusion/optimization magic is happening behind the scenes?
>
> Thanks,
> Jake Waksbaum
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From david.feuer at gmail.com Thu Aug 11 18:58:27 2016
From: david.feuer at gmail.com (David Feuer)
Date: Thu, 11 Aug 2016 14:58:27 -0400
Subject: [Haskell-cafe] library for set of heterogeneous values?
In-Reply-To: <1470890276.638665871@f25.my.com>
References: <1470890276.638665871@f25.my.com>
Message-ID:
I don't know if they're at all suitable for your purposes, but you
should look (at least for inspiration) at both vinyl and
dependent-map.
On Thu, Aug 11, 2016 at 12:37 AM, Anthony Clayden
wrote:
> I have a (let's call it) database of heterogeneous records.
>
> They're not Haskell records, but anonymous/extensible type-labelled rows.
> (Could be tuples, could be HLists, could be Lens-like, could be something
> fancier.)
>
> There's a small number (dozens) of distinct row types, each with a large
> number (thousands) of rows. The variety of row-types is not predictable in
> advance. And indeed a row might 'morph' over time with fields added/removed.
>
> So the obvious answer of putting the lot into a giant HList (each element of
> the list being a row) isn't going to scale. I could have a type-indexed
> HList in which each element is a Set of homogeneous rows. But performance
> still suffers from scanning along the list to find the right type index.
>
> Is there something better? On hackage there's two packages called HSet,
> neither giving very much help about their suitability:
>
> * `hset` (lower case) [AlekseyUymanov] seems isomorphic to a type-indexed
> HList.
> ie Must be unique type in each element (could be a Set type, I guess)
>
> * `HSet` (upper case) [athanclark] "Faux heterogeneous sets" seems a lot
> meatier
> why the "Faux"?
> built over hashtables in the ST monad.
>
> Has anybody used these? Can give guidance on what they can and can't?
>
> Bonus questions:
>
> Given a filter specifying a restriction on (some) fields of rows, I want to
> get a heterog subset:
> * all rows with at least those fields, matching those restrictions.
> * the restriction might be merely "has field labelled L".
>
> GIven a candidate row for insertion, I want first to scan for
> quasi-duplicates:
> * any existing row with a subset of the given fields, and the same value at
> those fields.
> * any existing row with a superset of the given fields, and the same value
> at those fields in common.
> * ignore records with only a partial overlap of fields.
>
> One possible data structure: a "vertical store".
> Give each row a Globally Unique Id.
> Have a separate set for each possible field,
> where the set elements are field value (key) to set of GUId -- records with
> that value.
>
> Then I have a different bonus question:
> * how to retrieve all field values for a given GUId?
>
>
> Thanks
> AntC
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From anthony_clayden at clear.net.nz Fri Aug 12 00:17:50 2016
From: anthony_clayden at clear.net.nz (Anthony Clayden)
Date: Fri, 12 Aug 2016 12:17:50 +1200
Subject: [Haskell-cafe] library for set of heterogeneous values?
Message-ID: <57ad15ae.20e.7427.993@clear.net.nz>
> I don't know if they're at all suitable for your purposes,
> but you should look (at least for inspiration) at both
> vinyl and dependent-map.
Thanks David,
vinyl is a record 'solution', not a set-of-records
repository
Really there's now too many bewildering choices for records;
representing the records is not the difficult part.
dependent-map, and
vault [Heinrich Apfelmus,thank you Sergei for the
suggestion]
seem to be (key, value) stores
so I'm not seeing how I 'query'/filter the values (the whole
records)
if I don't already know the keys for those records.
Contrast that with Data.Set [*],
you could stream the contents to a list and filter.
(Which would be horribly inefficient for my purposes.)
[*] Data.Set seems to have been swallowed into the new
collections library,
which is not currently maintained :-(
AntC
From ch.howard at zoho.com Fri Aug 12 05:12:29 2016
From: ch.howard at zoho.com (Christopher Howard)
Date: Thu, 11 Aug 2016 21:12:29 -0800
Subject: [Haskell-cafe] When you don't want to restrict the type of array...
Message-ID: <57AD5ABD.3060204@zoho.com>
Hi. I recently learned how to use Haskell IArrays and MArrays, and they
are quite convenient. I find myself often using some type of MArray for
performance reasons, but also some IArray type for array data that is
static in a set of computations.
Then I started wanting to use arrays inside other kinds of data types,
and so quickly ran into the question: what do you do if you want a data
type to contain an array, but you don't know in advance what array type
you'll be working with (immutable vs. mutible, boxed vs. unboxed).
My exploration of this question led to discovering something called
GADTs, which allowed me to do definitions like so
data Surface a where
ISurface :: IArray a e => (a Int Vertex) -> (a Int Face) -> Surface a
MSurface :: MArray a e m => (a Int Vertex) -> (a Int Face) -> Surface a
Am I heading down the right track here, or is there some better approach?
--
https://qlfiles.net
My PGP public key ID is 0x340EA95A (pgp.mit.edu).
From chpatrick at gmail.com Fri Aug 12 08:35:24 2016
From: chpatrick at gmail.com (Patrick Chilton)
Date: Fri, 12 Aug 2016 10:35:24 +0200
Subject: [Haskell-cafe] When you don't want to restrict the type of
array...
In-Reply-To: <57AD5ABD.3060204@zoho.com>
References: <57AD5ABD.3060204@zoho.com>
Message-ID:
First of all, the current standard for arrays is the vector
package, array is pretty
obsolete. Secondly, are you sure you want your functions to take both
immutable and mutable arrays? You could just make them take immutable ones,
and convert using (unsafe)freeze/thaw
beforehand.
Also, since you know that you'll only be storing Face and Vertex, you might
as well make an Unbox (or Storable) instance for them and use Unboxed (or
Storable) vectors.
Then you end up with:
import qualified Data.Vector.Unboxed as VU
data Surface = Surface { vertices :: VU.Vector Vertex, faces :: VU.Vector
Face }
render :: Surface -> IO ()
etc.
On Fri, Aug 12, 2016 at 7:12 AM, Christopher Howard
wrote:
> Hi. I recently learned how to use Haskell IArrays and MArrays, and they
> are quite convenient. I find myself often using some type of MArray for
> performance reasons, but also some IArray type for array data that is
> static in a set of computations.
>
> Then I started wanting to use arrays inside other kinds of data types,
> and so quickly ran into the question: what do you do if you want a data
> type to contain an array, but you don't know in advance what array type
> you'll be working with (immutable vs. mutible, boxed vs. unboxed).
>
> My exploration of this question led to discovering something called
> GADTs, which allowed me to do definitions like so
>
> data Surface a where
> ISurface :: IArray a e => (a Int Vertex) -> (a Int Face) -> Surface a
> MSurface :: MArray a e m => (a Int Vertex) -> (a Int Face) -> Surface a
>
> Am I heading down the right track here, or is there some better approach?
>
> --
> https://qlfiles.net
> My PGP public key ID is 0x340EA95A (pgp.mit.edu).
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From rae at cs.brynmawr.edu Fri Aug 12 13:35:33 2016
From: rae at cs.brynmawr.edu (Richard Eisenberg)
Date: Fri, 12 Aug 2016 09:35:33 -0400
Subject: [Haskell-cafe] =?utf-8?q?Hac_=CF=86=3A_a_Haskell_Exchange_in_Phil?=
=?utf-8?b?YWRlbHBoaWEsIE9jdCAyMeKAkzIz?=
Message-ID: <183295BF-B2E3-414B-A097-F2CF3ADA258F@cs.brynmawr.edu>
Hac Phi, a yearly weekend of Haskell in Philadelphia, will take place Oct. 21–23, 2016, at the University of Pennsylvania. Hac Phi is a gathering of hackers and Haskell enthusiasts. Come bring a project you’re working on or offer to help someone else on a project of theirs. Come give a talk if you’ve got something to share. Come to learn something new.
What do we mean by a “Haskell Exchange”? Less pressurized than a hackathon, more informal than a conference, bigger than a meetup – Hac Phi is a weekend where academics, professionals, and hobbyists can all meet, mingle, hack on each others’ projects, and generally have a good time. (And it’s not to be confused with *the* Haskell eXchange, an entirely different event.)
All the details are on [the wiki page](https://wiki.haskell.org/Hac_Phi); please [register online](https://goo.gl/forms/XXTxKFYAryVTjlgo2 ) if you’re coming.
We hope to see you there!
—The Hac φ team
Antal Spector-Zabusky
Kenny Foner
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From james.brown5374 at gmail.com Fri Aug 12 14:43:18 2016
From: james.brown5374 at gmail.com (James Brown)
Date: Fri, 12 Aug 2016 10:43:18 -0400
Subject: [Haskell-cafe] Need an example of new type constructor with zero
data constructors
Message-ID:
In the Haskell report 2010, a data declaration has the format of:
For a new type, there could be zero or more data constructors. What's the
use case for a new type that has zero data constructor?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jhenahan at me.com Fri Aug 12 14:52:41 2016
From: jhenahan at me.com (Jack Henahan)
Date: Fri, 12 Aug 2016 10:52:41 -0400
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
I haven't used Void enough to really be able to answer this, so here are
some links to information about the empty type.
https://wiki.haskell.org/Empty_type
https://hackage.haskell.org/package/void
http://stackoverflow.com/questions/14131856/whats-the-absurd-function-in-data-void-useful-for
Hope that helps.
James Brown writes:
> In the Haskell report 2010, a data declaration has the format of:
>
>
>
> For a new type, there could be zero or more data constructors. What's the
> use case for a new type that has zero data constructor?
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
--
Jack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL:
From adam at bergmark.nl Fri Aug 12 14:54:24 2016
From: adam at bergmark.nl (Adam Bergmark)
Date: Fri, 12 Aug 2016 16:54:24 +0200
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
What you posted is the format for data declarations, not newtypes. Newtypes
are required to have exactly one constructor:
newtype [context =>] simpletype = newconstr [deriving]
Adam
On Fri, Aug 12, 2016 at 4:43 PM, James Brown
wrote:
> In the Haskell report 2010, a data declaration has the format of:
>
>
>
>
> For a new type, there could be zero or more data constructors. What's the
> use case for a new type that has zero data constructor?
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jhenahan at me.com Fri Aug 12 14:59:46 2016
From: jhenahan at me.com (Jack Henahan)
Date: Fri, 12 Aug 2016 10:59:46 -0400
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
I think they mean "new type" to mean a data declaration, rather than a
newtype. I had to read it a few times before it clicked for me. Just a
confusion in terminology.
Adam Bergmark writes:
> What you posted is the format for data declarations, not newtypes. Newtypes
> are required to have exactly one constructor:
>
> newtype [context =>] simpletype = newconstr [deriving]
>
>
> Adam
>
> On Fri, Aug 12, 2016 at 4:43 PM, James Brown
> wrote:
>
>> In the Haskell report 2010, a data declaration has the format of:
>>
>>
>>
>>
>> For a new type, there could be zero or more data constructors. What's the
>> use case for a new type that has zero data constructor?
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
--
Jack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL:
From yashin.sergey at gmail.com Fri Aug 12 15:08:29 2016
From: yashin.sergey at gmail.com (Sergey N. Yashin)
Date: Fri, 12 Aug 2016 08:08:29 -0700 (PDT)
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
For zero data constructors you need to use only EmptyDataDecls
extension.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From james.brown5374 at gmail.com Fri Aug 12 15:16:16 2016
From: james.brown5374 at gmail.com (James Brown)
Date: Fri, 12 Aug 2016 11:16:16 -0400
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
What's the purpose to allow data declarations with no constructors?
On Fri, Aug 12, 2016 at 11:08 AM, Sergey N. Yashin
wrote:
> For zero data constructors you need to use only EmptyDataDecls
> extension.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From yashin.sergey at gmail.com Fri Aug 12 15:25:25 2016
From: yashin.sergey at gmail.com (Sergey N. Yashin)
Date: Fri, 12 Aug 2016 08:25:25 -0700 (PDT)
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID: <1dd786c7-c518-4968-b04d-60b909401fd0@googlegroups.com>
For example empty data declarations, *Fst *and *Snd *in the code bellow:
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Main where
data Fst
data Snd
data F a b = F b deriving Show
data S a b = S b deriving Show
class TupleVal a where
val :: a b -> b
instance a ~ Fst => TupleVal (F a) where
val (F v) = v
instance a ~ Fst => TupleVal (S a) where
val (S v) = v
class TupleOps (a :: * -> * -> *) b c where
type FST a b c
type SND a b c
tfst :: a b c -> FST a b c
tsnd :: a b c -> SND a b c
instance (b ~ F b' b'', b' ~ Fst, c ~ S c' c'', c' ~ Snd) => TupleOps (,)
b c where
type FST (,) b c = b
type SND (,) b c = c
tfst = fst
tsnd = snd
instance TupleOps F b (c1, c2) where
type FST F b (c1, c2) = c1
type SND F b (c1, c2) = c2
tfst (F (v1, v2)) = v1
tsnd (F (v1, v2)) = v2
instance TupleOps S b (c1, c2) where
type FST S b (c1, c2) = c1
type SND S b (c1, c2) = c2
tfst (S (v1, v2)) = v1
tsnd (S (v1, v2)) = v2
type First a = F Fst a
type Second a = S Snd a
type a @@ b = (First a, Second b)
type family a :=: b where
Fst :=: b = Fst' b
Snd :=: b = Snd' b
infixr 1 :=:
type family Fst' a where
Fst' (a, b) = a
Fst' (First a) = Fst' a
Fst' (Second a) = Fst' a
type family Snd' a where
Snd' (a, b) = b
Snd' (First a) = Snd' a
Snd' (Second a) = Snd' a
(@@) :: a -> b -> a @@ b
a @@ b = (F a, S b)
tpl1 :: Int @@ String
tpl1 = 1 @@ "hello"
tpl2 :: Snd :=: String @@ String
tpl2 = tsnd ("hello" @@ "world")
tpl3 :: Snd :=: String @@ String
tpl3 = tsnd ("hello" @@ "world")
tpl4 :: Int @@ String
tpl4 = 1 @@ "hello"
tpl5 :: Snd :=: String @@ (String @@ String)
tpl5 = tsnd ("hello" @@ ("hello" @@ "world"))
tpl6 :: Snd :=: Fst :=: Snd :=: (String @@ String) @@ ((String @@ String)
@@ String)
tpl6 = tsnd . tfst . tsnd $ ("world1" @@ "hello2") @@ (("hello3" @@
"world5") @@ "world4")
main :: IO ()
main = do
print tpl4
print tpl3
print tpl2
print tpl6
пятница, 12 августа 2016 г., 18:16:18 UTC+3 пользователь James Brown
написал:
>
> What's the purpose to allow data declarations with no constructors?
>
> On Fri, Aug 12, 2016 at 11:08 AM, Sergey N. Yashin > wrote:
>
>> For zero data constructors you need to use only EmptyDataDecls
>> extension.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From michaelburge at pobox.com Fri Aug 12 15:28:27 2016
From: michaelburge at pobox.com (Michael Burge)
Date: Fri, 12 Aug 2016 08:28:27 -0700
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
One use is when you want an open sum type rather than a closed one. For
example, you might want users of your library to add their own
'constructors'. Then, they serve a purpose similar to a constructor that
takes no arguments:
{-# LANGUAGE EmptyDataDecls #-}
class Color a where
rgb :: a -> (Int, Int, Int)
data Red
data Green
data Blue
instance Color Red where
rgb _ = (255, 0, 0)
instance Color Green where
rgb _ = (0, 255, 0)
instance Color Blue where
rgb _ = (0, 0, 255)
data ColorADT = Color_Red | Color_Green | Color_Blue
rgb_adt Color_Red = (255, 0, 0)
rgb_adt Color_Green = (0, 255, 0)
rgb_adt Color_Blue = (0, 0, 255)
On Fri, Aug 12, 2016 at 8:16 AM, James Brown
wrote:
> What's the purpose to allow data declarations with no constructors?
>
> On Fri, Aug 12, 2016 at 11:08 AM, Sergey N. Yashin <
> yashin.sergey at gmail.com> wrote:
>
>> For zero data constructors you need to use only EmptyDataDecls
>> extension.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From amindfv at gmail.com Fri Aug 12 16:28:09 2016
From: amindfv at gmail.com (amindfv at gmail.com)
Date: Fri, 12 Aug 2016 12:28:09 -0400
Subject: [Haskell-cafe] Need an example of new type constructor with
zero data constructors
In-Reply-To:
References:
Message-ID:
Another use:
class Foo a e | a -> e where
foo :: a -> Either e a
instance Foo Int Void where
foo :: Int -> Either Void Int
foo x = Right (x + 1)
Even though it's an "Either", we're saying we will never (ignoring bottom) return a "Left" value.
Tom
> El 12 ago 2016, a las 11:28, Michael Burge escribió:
>
> One use is when you want an open sum type rather than a closed one. For example, you might want users of your library to add their own 'constructors'. Then, they serve a purpose similar to a constructor that takes no arguments:
>
> {-# LANGUAGE EmptyDataDecls #-}
>
> class Color a where
> rgb :: a -> (Int, Int, Int)
>
> data Red
> data Green
> data Blue
>
> instance Color Red where
> rgb _ = (255, 0, 0)
>
> instance Color Green where
> rgb _ = (0, 255, 0)
>
> instance Color Blue where
> rgb _ = (0, 0, 255)
>
> data ColorADT = Color_Red | Color_Green | Color_Blue
> rgb_adt Color_Red = (255, 0, 0)
> rgb_adt Color_Green = (0, 255, 0)
> rgb_adt Color_Blue = (0, 0, 255)
>
>
>> On Fri, Aug 12, 2016 at 8:16 AM, James Brown wrote:
>> What's the purpose to allow data declarations with no constructors?
>>
>>> On Fri, Aug 12, 2016 at 11:08 AM, Sergey N. Yashin wrote:
>>> For zero data constructors you need to use only EmptyDataDecls extension.
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From monkleyon at googlemail.com Fri Aug 12 19:58:52 2016
From: monkleyon at googlemail.com (MarLinn)
Date: Fri, 12 Aug 2016 21:58:52 +0200
Subject: [Haskell-cafe] Which is the most "hackable" compiler?
Message-ID: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
So I have some crazy ideas for language extensions/reinterpretations and
ways I might try to implement them. But ghc is a complex beast and my
crazy ideas have too many interrelationships for a noob like me to try
to bold them onto it. After all, I have never worked on ghc - or any
compiler for that matter. I did look at the code, but I reckon maybe I
should gather some experience first before diving into that one. It
would be even worse to offload my ideas onto someone else before I at
least tried them and got some feedback. No fun for anyone.
But of course I don't want to start from scratch. As fun as that could
be, there's no need to reinvent all the wheels just for a different
axle. And I hear rumors that there are other Haskell compilers out
there, even if most of them live in the shadow/slipstream of their
brother. Alas, I don't have any idea what their statuses and
philosophies are.
So maybe you can help me here: Have you experienced any of the
alternative compilers as especially easy for a newcomer to pick up and
play around with? If it helps, I would be satisfied with plain
Haskell2010 or even Haskell 98, although some GADT and/or TypeFamilies
code to butcher would be nice, too. The ideas are mostly about larger
scale structures like whole functions. One representative example idea
is "Could it help the implementation - and does it even make sense - to
view a module as just a weirdly written zero parameter type class?" As I
said: crazy ideas.
I'm thankful for any thoughts and ideas.
MarLinn
From sergey.bushnyak at sigrlami.eu Sat Aug 13 06:51:12 2016
From: sergey.bushnyak at sigrlami.eu (Sergey Bushnyak)
Date: Sat, 13 Aug 2016 09:51:12 +0300
Subject: [Haskell-cafe] Which is the most "hackable" compiler?
In-Reply-To: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
References: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
Message-ID: <31dd183e-7d5c-d2b7-e013-d80852729a73@sigrlami.eu>
You should go for a long run with GHC, it has most advanced extension
system and you'll be able to integrate your extensions with existing
codebase if they come out successful.
If you still want to work with hackablel compiler look at jhc
https://github.com/jimcrayne/jhc and it's fork ajhc
https://github.com/ajhc/ajhc they are very low-level but codebase very
small and you can grasp whole system very quickly to start hacking
On 08/12/2016 10:58 PM, MarLinn via Haskell-Cafe wrote:
> So I have some crazy ideas for language extensions/reinterpretations
> and ways I might try to implement them. But ghc is a complex beast and
> my crazy ideas have too many interrelationships for a noob like me to
> try to bold them onto it. After all, I have never worked on ghc - or
> any compiler for that matter. I did look at the code, but I reckon
> maybe I should gather some experience first before diving into that
> one. It would be even worse to offload my ideas onto someone else
> before I at least tried them and got some feedback. No fun for anyone.
>
> But of course I don't want to start from scratch. As fun as that could
> be, there's no need to reinvent all the wheels just for a different
> axle. And I hear rumors that there are other Haskell compilers out
> there, even if most of them live in the shadow/slipstream of their
> brother. Alas, I don't have any idea what their statuses and
> philosophies are.
>
> So maybe you can help me here: Have you experienced any of the
> alternative compilers as especially easy for a newcomer to pick up and
> play around with? If it helps, I would be satisfied with plain
> Haskell2010 or even Haskell 98, although some GADT and/or TypeFamilies
> code to butcher would be nice, too. The ideas are mostly about larger
> scale structures like whole functions. One representative example idea
> is "Could it help the implementation - and does it even make sense -
> to view a module as just a weirdly written zero parameter type class?"
> As I said: crazy ideas.
>
> I'm thankful for any thoughts and ideas.
>
>
> MarLinn
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
From dburke.gw at gmail.com Sat Aug 13 07:06:00 2016
From: dburke.gw at gmail.com (Doug Burke)
Date: Sat, 13 Aug 2016 07:06:00 +0000
Subject: [Haskell-cafe] library for set of heterogeneous values?
In-Reply-To: <57ad15ae.20e.7427.993@clear.net.nz>
References: <57ad15ae.20e.7427.993@clear.net.nz>
Message-ID:
Frames - http://acowley.github.io/Frames/ - is built on top of vinyl and
provides one way to access data either as an array of structures or a
structures of arrays. I'm on my phone (hence the use of top posting) so I
can't productively check whether it allows the kind of filtering you were
asking for.
Doug
On Fri, Aug 12, 2016, 01:18 Anthony Clayden
wrote:
> > I don't know if they're at all suitable for your purposes,
> > but you should look (at least for inspiration) at both
> > vinyl and dependent-map.
>
> Thanks David,
>
> vinyl is a record 'solution', not a set-of-records
> repository
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From gregmainland at gmail.com Sat Aug 13 19:17:13 2016
From: gregmainland at gmail.com (Greg Horn)
Date: Sat, 13 Aug 2016 19:17:13 +0000
Subject: [Haskell-cafe] (job) haskell software engineer for
autopilot/simulation environment
Message-ID:
We are a small, fast moving R&D group in Kitty Hawk
writing autopilots in Haskell and code-generating
to C. The ground station and simulation environment are written almost
entirely in Haskell, and are mostly open-source. We are currently flight
testing a few different novel vehicles.
We're looking for an experienced software engineer familiar with simulation
and control of dynamic systems, real-time systems, robotics, or similar.
The role is initially to support and expand the existing simulation and
control infrastructure, but will be flexible based on your interests and
expertise.
If this is interesting to you, please see the full description at:
https://jobs.lever.co/kittyhawk.aero/89a6630b-4210-4a4a-89d8-936d458f6c8a?lever-source=HaskellCafe
Best regards,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From benl at ouroborus.net Sun Aug 14 00:20:00 2016
From: benl at ouroborus.net (Ben Lippmeier)
Date: Sun, 14 Aug 2016 10:20:00 +1000
Subject: [Haskell-cafe] Which is the most "hackable" compiler?
In-Reply-To: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
References: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
Message-ID:
> On 13 Aug 2016, at 5:58 AM, MarLinn via Haskell-Cafe wrote:
>
> So maybe you can help me here: Have you experienced any of the alternative compilers as especially easy for a newcomer to pick up and play around with? If it helps, I would be satisfied with plain Haskell2010 or even Haskell 98, although some GADT and/or TypeFamilies code to butcher would be nice, too. The ideas are mostly about larger scale structures like whole functions.
You might want to check out DDC [1]. It’s still in a pre-alpha state, but what it does have is a working external core language. You could write your own front end that produces System-F, then have DDC compile that. The individual compiler passes are also fairly well separated, so it’s easy to change.
> One representative example idea is "Could it help the implementation - and does it even make sense - to view a module as just a weirdly written zero parameter type class?" As I said: crazy ideas.
This is perfectly reasonable. I think Agda does something similar.
Ben.
[1] http://disciple.ouroborus.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From amindfv at gmail.com Sun Aug 14 02:53:39 2016
From: amindfv at gmail.com (amindfv at gmail.com)
Date: Sat, 13 Aug 2016 22:53:39 -0400
Subject: [Haskell-cafe] Which is the most "hackable" compiler?
In-Reply-To:
References: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
Message-ID:
GHC compiler plugins may also be what you're looking for.
Also, does ghc not compile core files anymore? It used to; you can always use an older ghc version.
Tom
> El 13 ago 2016, a las 20:20, Ben Lippmeier escribió:
>
>
>
>
>> On 13 Aug 2016, at 5:58 AM, MarLinn via Haskell-Cafe wrote:
>>
>> So maybe you can help me here: Have you experienced any of the alternative compilers as especially easy for a newcomer to pick up and play around with? If it helps, I would be satisfied with plain Haskell2010 or even Haskell 98, although some GADT and/or TypeFamilies code to butcher would be nice, too. The ideas are mostly about larger scale structures like whole functions.
>
> You might want to check out DDC [1]. It’s still in a pre-alpha state, but what it does have is a working external core language. You could write your own front end that produces System-F, then have DDC compile that. The individual compiler passes are also fairly well separated, so it’s easy to change.
>
>
>> One representative example idea is "Could it help the implementation - and does it even make sense - to view a module as just a weirdly written zero parameter type class?" As I said: crazy ideas.
>
> This is perfectly reasonable. I think Agda does something similar.
>
> Ben.
>
>
> [1] http://disciple.ouroborus.net/
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From benl at ouroborus.net Sun Aug 14 03:06:42 2016
From: benl at ouroborus.net (Ben Lippmeier)
Date: Sun, 14 Aug 2016 13:06:42 +1000
Subject: [Haskell-cafe] Which is the most "hackable" compiler?
In-Reply-To:
References: <2bc73278-430a-bcf7-527c-5b0b385cf82e@gmail.com>
Message-ID:
> On 14 Aug 2016, at 12:53 PM, amindfv at gmail.com wrote:
>
> GHC compiler plugins may also be what you're looking for.
>
> Also, does ghc not compile core files anymore? It used to; you can always use an older ghc version.
IIRC GHC once could produce external core files, but it was never able to parse them back. The support rotted, so it was removed a few years ago.
The way GHC is engineered makes it difficult/impossible for core-to-core plugins to introduce names into the core file that were not already present. Plugins can *rearrange* code that contains existing identifiers, but once the front-end type checker/desugarer is finished there isn’t an easy way to load more interface files to get at other names of things. This was the state of GHC in 2013 when I was working on the Repa plugin [1], it might have changed since then.
Ben.
[1] https://hackage.haskell.org/package/repa-plugin
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From will.yager at gmail.com Sun Aug 14 03:10:15 2016
From: will.yager at gmail.com (William Yager)
Date: Sat, 13 Aug 2016 20:10:15 -0700
Subject: [Haskell-cafe] The relationship between F-algebras and the Free
Monad
Message-ID:
Hello all,
I recently read the article "Understanding F-algebras"[1], which goes over
the usage of F-algebras for e.g. evaluating ASTs. This article goes over how
1. Data.Fix creates the initial F-algebra over a functor f.
2. We can express our AST as a non-recursive functor instead of a recursive
type
3. We can express our evaluator as an Algebra (of the type `f a -> a`,
where f is the type of our AST and `a` is the Algebra's carrier type, i.e.
our result type)
4. We can express terms in our language as members of the type `Fix AST`
(i.e. the initial F-algebra over our AST).
5. By using a catamorphism over our evaluator algebra, we can easily
construct an efficient evaluator.
As a brief example of these principles, see the following program (using
DeriveFunctor):
data AST a = Lit Int | Add a a deriving Functor
-- data Fix f = Fix (f (Fix f)) -- defined in Data.Fix
type AST' = Fix AST
program :: AST'
program = Fix $ Add (Fix $ Lit 5) (Fix $ Lit 4)
alg :: AST Int -> Int
alg (Lit i) = i
alg (Add l r) = l + r
eval :: AST' -> Int
eval = Data.Fix.cata alg
main = print $ eval program
This is super cool!
One thing that stood out to me is that there are a number of similarities
here with the usage of the Free Monad. In particular, see "Why free monads
matter" [2]. This article is doing basically the exact same thing. You
express your AST as a non-recursive functor parametrized over the type of
subterms. However, instead of making your terms of type `Fix AST`, they are
of type `Free AST a`.
Now, the recursive constructor for Free is almost identical to the
constructor for Fix, except of course the additional type parameter `a`.
However, both types are of the form `data T = R (f T)`. Free simply has the
additional `Pure` constructor as well.
So obviously, there is some sort of relationship here. However, I don't
have a good enough grasp on these concepts for the relationship to make
itself fully apparent. Some things I've noticed:
Operations on `Fix AST` terminate because the AST type has leaf
constructors without recursion. So a catamorphism over an evaluation
algebra can plausibly terminate because eventually it will hit a leaf node
and the evaluation will stop. On the other hand, operations on `Free AST a`
can also terminate because you might run into a `Pure` constructor. The
difference being that `Pure` is a part of the wrapper type (Free) and not
the wrapped type (AST).
A practical question I have is: Can we use the Free Monad to write AST
terms using `do` notation (useful for DSLs) and then use the elegant
catamorphism evaluator trick (or something similar) to evaluate our ASTs?
Or does evaluating the Free Monad require something more general due to the
Pure constructor? It looks like `Control.Monad.Free.iter` might be
equivalent to `Data.Fix.cata`, but I'm not sure. It looks like a rough
translation works in this case:
data AST a = Add a a deriving Functor -- No more "Const"
type AST' a = Free AST a
program :: AST' Int
program = Free $ Add (Pure 5) (Pure 4)
alg :: AST Int -> Int
alg (Add l r) = l + r
eval :: AST' Int -> Int
eval = Control.Monad.Free.iter alg
main = print $ eval program
So, intuitively, it seems like Free lets us do basically the same thing as
Fix but with the evaluation result present as the last argument of the
expression type.
Sorry for being a bit rambly, and I may also be completely off base here,
so correct me if I'm not making any sense.
Cheers,
Will
[1] https://www.schoolofhaskell.com/user/bartosz/understanding-algebras
[2]
http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From anthony_clayden at clear.net.nz Sun Aug 14 10:52:57 2016
From: anthony_clayden at clear.net.nz (=?UTF-8?B?QW50aG9ueSBDbGF5ZGVu?=)
Date: Sun, 14 Aug 2016 13:52:57 +0300
Subject: [Haskell-cafe] =?utf-8?q?Data=2ESet_optimisations_=5Bwas=3A__libr?=
=?utf-8?q?ary_for_set_of_heterogeneous_values=3F=5D?=
In-Reply-To:
References: <1470890276.638665871@f25.my.com>
Message-ID: <1471171977.697413830@f13.my.com>
Firstly, to correct myself:
> Contrast that with Data.Set [*],
you could stream the contents to a list and filter.
> (Which would be horribly inefficient for my purposes.)
Thank you Libraries team. Data.Set seems to have been seriously revamped since I last looked, and now includes a 'proper' filter function. (It used to stream the Set to a List; filter the List; build a new Set.)
> [*] Data.Set seems to have been swallowed into the new
collections library,
> which is not currently maintained
Uhh. That was a dead link (of ~10 years ago, but Google still took me to it). Data.Set is in the **containers** library supported on hackage.
But I have some q's about the optimisations:
The hedge-union algorithm seems to have been taken out, as inefficient.
(per treeowl on github). But the code on hackage still uses hedge??
So the docos are out of date. (And quite a bit of commentary on StackOverflow.)
Was it really not more efficient?
The Set data type's constructors got reordered (Bin is now first, Tip is second).
On grounds it "improves the benchmark by up to 10%".
Are you sure it makes that much difference?
Are you sure it makes any difference at all?
The culprit seems to be pattern matching. It makes me feel there's something seriously wrong with GHC's code generator.
(And the semantics of ADTs is that the first constructor is ordered first if you go `deriving (Ord)`. So there's usually a design reason driving the ordering of constructors -- eg Nothing ordered before Just; [] ordered before (:), which makes String ordering do the right thing.)
Set is a purely functional data structure, no in-situ updating of nodes, no pointer semantics
unlike imperative/low-level implementations of balanced binary trees.
That means Tips (empty end-points) genuinely get allocated/built and accessed and garbaged on insert -- or does all that strictness annotation/INLINing alter that?
Contrast that in an imperative/low-level model they'd be null pointers, nothing allocated.
Note the number of Tips is equal the number of values in the tree, + 1.
Would it save construction/destruction/access overhead to have three extra constructors?
| both sub-trees are empty
| left (only) is empty
| right (only) is empty
If it's true per above that each constructor adds a performance penalty just doing the pattern matching, I guess the answer is 'no' :-(
Thanks
AntC
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From david.feuer at gmail.com Sun Aug 14 12:05:36 2016
From: david.feuer at gmail.com (David Feuer)
Date: Sun, 14 Aug 2016 08:05:36 -0400
Subject: [Haskell-cafe] Data.Set optimisations [was: library for set of
heterogeneous values?]
In-Reply-To: <1471171977.697413830@f13.my.com>
References: <1470890276.638665871@f25.my.com>
<1471171977.697413830@f13.my.com>
Message-ID:
I don't really think we need to bring *two* mailing lists into this. I'm
treeowl. The hedge algorithms were usually slower on benchmarks and never
much faster. Their theoretical performance has never been understood well.
Divide and conquer is fast, and its theoretical performance bound is now
understood to be good. The new code is not on Hackage because I haven't
made a release yet. containers doesn't usually release a major version more
than once a year. This year it may get two, but there's no need to rush.
The Tip constructor is not allocated over and over. Nullary constructors of
any given type are shared. So there's just one Tip somewhere. GHC's pointer
tagging means that the pointers to Tip are almost never followed. Pattern
matching on a Tip value ends up just inspecting the two (32-bit) or three
(64-bit) tag bits on the pointer to it.
Yes, constructor order makes a difference, weird as that seems. When GHC
desugars a pattern match, it always reorders the case branches into
constructor order. Sometimes this is obviously good; certain large case
expressions are turned into jump tables. Sometimes this is not so good. One
of my predecessors (probably Milan Straka, but I'm not sure) ran a lot of
benchmarks and picked the constructor order that was usually best.
Milan Straka wrote a paper that, among other things, recommended adding an
additional singleton constructor. I don't actually know why he didn't do
that; I can try to ask him. It's possible that it made some things better
and others worse.
On Aug 14, 2016 6:52 AM, "Anthony Clayden"
wrote:
> Firstly, to correct myself:
>
> > Contrast that with Data.Set [*], you could stream the contents to a list
> and filter.
> > (Which would be horribly inefficient for my purposes.)
>
> Thank you Libraries team. Data.Set seems to have been seriously revamped
> since I last looked, and now includes a 'proper' filter function. (It used
> to stream the Set to a List; filter the List; build a new Set.)
>
> > [*] Data.Set seems to have been swallowed into the new collections
> library,
> > which is not currently maintained
>
> Uhh. That was a dead link (of ~10 years ago, but Google still took me to
> it). Data.Set is in the **containers** library supported on hackage.
>
> But I have some q's about the optimisations:
> The hedge-union algorithm seems to have been taken out, as inefficient.
> (per treeowl on github). But the code on hackage still uses hedge??
> So the docos are out of date. (And quite a bit of commentary on
> StackOverflow.)
> Was it really not more efficient?
>
> The Set data type's constructors got reordered (Bin is now first, Tip is
> second).
> On grounds it "improves the benchmark by up to 10%".
> Are you sure it makes that much difference?
> Are you sure it makes any difference at all?
> The culprit seems to be pattern matching. It makes me feel there's
> something seriously wrong with GHC's code generator.
> (And the semantics of ADTs is that the first constructor is ordered first
> if you go `deriving (Ord)`. So there's usually a design reason driving the
> ordering of constructors -- eg Nothing ordered before Just; [] ordered
> before (:), which makes String ordering do the right thing.)
>
> Set is a purely functional data structure, no in-situ updating of nodes,
> no pointer semantics
> unlike imperative/low-level implementations of balanced binary trees.
> That means Tips (empty end-points) genuinely get allocated/built and
> accessed and garbaged on insert -- or does all that strictness
> annotation/INLINing alter that?
>
> Contrast that in an imperative/low-level model they'd be null pointers,
> nothing allocated.
> Note the number of Tips is equal the number of values in the tree, + 1.
> Would it save construction/destruction/access overhead to have three
> extra constructors?
> | both sub-trees are empty
> | left (only) is empty
> | right (only) is empty
>
> If it's true per above that each constructor adds a performance penalty
> just doing the pattern matching, I guess the answer is 'no' :-(
>
> Thanks
> AntC
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From james.brown5374 at gmail.com Sun Aug 14 13:32:18 2016
From: james.brown5374 at gmail.com (James Brown)
Date: Sun, 14 Aug 2016 09:32:18 -0400
Subject: [Haskell-cafe] Function and pattern bindings
Message-ID:
I am reading Haskell report 2010 and I can't understand the differences
between function bindings and pattern bindings. Can anyone explain the
differences?
​​​​​​​
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-08-14 at 9.27.21 AM.png
Type: image/png
Size: 174615 bytes
Desc: not available
URL:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-08-14 at 9.27.39 AM.png
Type: image/png
Size: 243854 bytes
Desc: not available
URL:
From adam at bergmark.nl Sun Aug 14 13:39:32 2016
From: adam at bergmark.nl (Adam Bergmark)
Date: Sun, 14 Aug 2016 15:39:32 +0200
Subject: [Haskell-cafe] Function and pattern bindings
In-Reply-To:
References:
Message-ID:
Hi James,
I think the difference they want to convey is that a function binding names
an identifier and can contain several patterns, e.g. `foo [x] y = x + y`
whereas a pattern binding is just one pattern, e.g. `[x]` or `y` in the
earlier example. Function bindings can be desugared to case expressions
with patterns.
Adam
On Sun, Aug 14, 2016 at 3:32 PM, James Brown
wrote:
> I am reading Haskell report 2010 and I can't understand the differences
> between function bindings and pattern bindings. Can anyone explain the
> differences?
>
> ​​​​​​​
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From michael at schmong.org Sun Aug 14 19:30:36 2016
From: michael at schmong.org (Michael Litchard)
Date: Sun, 14 Aug 2016 12:30:36 -0700
Subject: [Haskell-cafe] Twitter coding kata
Message-ID:
I've been told that there is a twitter feed that gives out little haskell
exercises. Can't find it. Anyone know about it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From damian.only at gmail.com Sun Aug 14 19:42:07 2016
From: damian.only at gmail.com (Damian)
Date: Sun, 14 Aug 2016 21:42:07 +0200
Subject: [Haskell-cafe] Twitter coding kata
In-Reply-To:
References:
Message-ID:
I don't know about the feed, but a while ago I was playing with some
exercises at exercism.io. Maybe you'd find it interesting.
Regards,
Damian
Op 14 aug. 2016 21:30 schreef "Michael Litchard"