Re: [Haskell-cafe] delete http://www.haskell.org/haskellwiki/Haskell_IDE

2012-11-29 Thread Roman Beslik

Good point. Done.

On 29.11.12 06:16, Conrad Parker wrote:

#REDIRECT [[IDEs]]


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] delete http://www.haskell.org/haskellwiki/Haskell_IDE

2012-11-28 Thread Roman Beslik
Hi. There is more verbose page http://www.haskell.org/haskellwiki/IDEs . 
I registered on http://www.haskell.org/haskellwiki/ , but have not found 
the Delete Page command, wiki software help pages, or feedback 
channel, so I'm writing here.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] delete http://www.haskell.org/haskellwiki/Haskell_IDE

2012-11-28 Thread Roman Beslik

A humble link What links here to the right will help you find those pages.

On 28.11.12 21:53, Brent Yorgey wrote:

is probably not a good idea anyway -- what if there are other pages
that link to it?



On Wed, Nov 28, 2012 at 07:08:16PM +0200, Roman Beslik wrote:

Hi. There is more verbose page
http://www.haskell.org/haskellwiki/IDEs . I registered on
http://www.haskell.org/haskellwiki/ , but have not found the Delete
Page command, wiki software help pages, or feedback channel, so I'm
writing here.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


case of an empty type should have no branches

2011-10-09 Thread Roman Beslik

Hi.

Why the following code does not work?
 data Empty
 quodlibet :: Empty - a
 quodlibet x = case x of
parse error (possibly incorrect indentation)

This works in Coq, for instance. Demand for empty types is not big, but 
they are useful for generating finite types:

 Empty ≅ {}
 Maybe Empty ≅ {0}
 Maybe (Maybe Empty) ≅ {0, 1}
 Maybe (Maybe (Maybe Empty)) ≅ {0, 1, 2}
etc. Number of 'Maybe's = number of elements. I can replace @Maybe 
Empty@ with @()@, but this adds some complexity.


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: case of an empty type should have no branches

2011-10-09 Thread Roman Beslik

On 09.10.11 15:45, Felipe Almeida Lessa wrote:

On Sun, Oct 9, 2011 at 8:26 AM, Roman Beslikber...@ukr.net  wrote:

Why the following code does not work?

data Empty
quodlibet :: Empty -  a
quodlibet x = case x of

parse error (possibly incorrect indentation)

Works for me:

   data Empty

   quodlibet :: Empty -  a
   quodlibet x = case x of _ -  undefined

This is a solution. Thanks.


I'd prefer to define something like

   data Finite = Zero | Plus Finite


You just defined the set of natural numbers which is infinite. ;)

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Best bit LIST data structure

2011-10-09 Thread Roman Beslik

I am not aware of such a library, but IMHO this code will be very simple.
 data Bits b = BitList b = BitList Int {- number of used bits in the 
next component -} b [b]

Write an isomorphism between @BitList b@ and @ListStep (BitList b)@
where
 data ListStep e rc = Nil | Cons e rc

On 07.10.11 17:52, Ryan Newton wrote:

Hi Cafe,

We are lucky to have a plethora of data structures out there.  But it 
does make choosing one off hackage difficult at times.  In this case 
I'm *not* looking for a O(1) access bit vector (Data.Vector.Unboxed 
seems to be the choice there), but an efficient representation for a 
list of bits (cons,head,tail).


Let's say that you want to represent tree indices as you walk down a 
binary tree.  [Bool] is a simple choice, you only add to the front of 
the list (0/1 = Left/Right), sharing the tails.  But [Bool] is quite 
space inefficient.


Something like [Int] would allow packing the bits more efficiently.  A 
Lazy ByteString could amortize the space overhead even more... but in 
both cases there's a tiny bit of work to do in wrapping those 
structures for per-bit access.  That's probably the right thing but I 
wanted to check to see if there's something else recommended, perhaps 
more off-the-shelf.


What about just using the Data.Bits instance of Integer?  Well, 
presently, the setBit instance for very large integers creates a whole 
new integer, shifts, and xors:
http://haskell.org/ghc/docs/latest/html/libraries/base/src/Data-Bits.html#setBit 

(I don't know if it's possible to do better.  From quick googling GMP 
seems to use an array of limbs rather than a chunked list, so maybe 
there's no way to treat large Integers as a list and update only the 
front...)


Advice appreciated!

Thanks,
  -Ryan


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best bit LIST data structure

2011-10-09 Thread Roman Beslik
Yes, if you do not use high-level concepts and optimize everything by 
hand, it requires a lot of testing. :)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] categories in Haskell and module names

2011-10-05 Thread Roman Beslik

Hello.

IMHO there are 2 ways to define categories in Haskell:
W0) the category of types and functions (base.Data.Functor and company 
belongs to it);

W1) the class base.Control.Category.Category.
(Defining a category where the class of objects is a type seems 
impossible in Haskell.)


But these ways are mingled in base. E.g. Control.Applicative (W0) 
and Control.Category (W1) are neighbors. Oddly, Data.Functor (W0) is 
under Data. I believe that the whole library category-extras belongs 
to W1.


I suggest to split these ways under distinct names, e.g.:
W0) Category.Function (@hom == (-)@);
W1) Category.Hom (hom is an abstract type constructor).
Maybe both should be under Mathematics.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] module - package

2011-09-30 Thread Roman Beslik
Hello. How can I find which installed package a specified module belongs 
to? ghci or cabal or ghc-pkg?


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell Forum

2010-07-26 Thread Roman Beslik
 Hi. I personally find web-forum a more convenient and structured way 
of communication. I will help if the forum exports posts or topics as a 
feed.


Are you strictly devoted to phpBB? I think that fluxBB is a decent 
choice. Just suggesting.


On 26.07.10 16:30, Daniel Díaz wrote:
I want to open a Haskell forum based on phpBB, but I need some 
collaborators for organize its content, and moderate its use.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Handling absent maintainers

2010-07-24 Thread Roman Beslik
 I patch broken packages in my local repository. I increment a version 
so the local repository get a precedence over the Hackage.


On 16.07.10 03:54, Mark Wotton wrote:

2. run my own hackage server and tell my users to use that instead.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] a patch for base.Foreign.C.String, the current locale

2010-07-24 Thread Roman Beslik
 Hi. I have composed a patch that implements Foreign.C.String according 
to Foreign Function Interface Addendum, i.e. C strings are treated as 
they are encoded with the current locale. Search Locale.hs in the 
patch for further directions. Ask if you do not know how to build a 
patched version of the base library.

http://www.beroal.in.ua/prg/haskell/locale.patch

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Equivalence of two expressions

2010-07-10 Thread Roman Beslik

 Hi.
On 10.07.10 21:40, Grigory Sarnitskiy wrote:

I'm not very familiar with algebra and I have a question.

Imagine we have ring K. We also have two expressions formed by elements from K 
and binary operations (+) (*) from K.

In what follows I assume elements from K == variables

Can we decide weather these two expressions are equivalent? If there is such an 
algorithm, where can I find something in Haskell about it?
Using distributivity of ring you convert an expression to a normal form. 
A normal form is a sum of products. If normal forms are equal (up to 
associativity and commutativity of ring), expressions are equivalent. I 
am not aware whether Haskell has a library.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-28 Thread Roman Beslik

 In the case of 'deleteBy' we can improve an API.
  deleteBy eq x xs == deletePred (eq x) xs
@deletePred pred xs@ removes the first element of @xs@ which satisfies a 
predicate @p...@.

Your solution is more general. :)

On 28.06.10 22:44, Albert Y.C.Lai wrote:

And then some programmers are in a miserable state of not respecting docs
when the docs are complete.

Why should anyone expect

   deleteBy (=) 5 [0..10]


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-27 Thread Roman Beslik

 On 27.06.10 04:07, Brandon S Allbery KF8NH wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 6/26/10 19:52 , Roman Beslik wrote:

I fail to see how it will brake programs. Current programs do not use
Unicode because it is implemented incorrectly.

Currently, FilePath is an alias for String.  Changing FilePath to a real
type

Just do not change FilePath, what may be simpler?

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-27 Thread Roman Beslik

 On 27.06.10 03:58, Felipe Lessa wrote:

On Sun, Jun 27, 2010 at 02:55:33AM +0300, Roman Beslik wrote:

  On 26.06.10 15:44, Felipe Lessa wrote:

However, suppose your program needs to create a file with a name
based on a database information.  Your database is UTF-8.  How do
you translate that UTF-8 data into a filepath?  This is the
problem we got in Haskell.  We have a nice coding-agnostic String
datatype, but we don't know how to create a file with this very
name.

It is simple — you recode from (database | network server | file)
encoding to the current locale.

Recoding is indeed very simple.  You know the source coding
(e.g. your database is in UTF-8).  But how do you discover the
target coding?  How can you find out that this system uses
ISO8859-1, while this other one uses UTF-16, while...?

See the problem now? :)
No! The target encoding is the current locale. It is a no-brainer to 
find it. Use your Unix.

$ man setlocale
$ locale

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-27 Thread Roman Beslik

 On 27.06.10 09:38, Bulat Ziganshin wrote:

Sunday, June 27, 2010, 3:52:54 AM, you wrote:

I fail to see how it will brake programs. Current programs do not use
Unicode because it is implemented incorrectly.

i use it. current Linux implementation treats String as sequence of
bytes, and with manual recoding it allows to use filesystems with
any encoding
O'kay, but IMHO few people want to have a headache with recoding. You 
knew that the implementation was incorrect, why you relied on it?


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-27 Thread Roman Beslik

 On 27.06.10 10:17, Bulat Ziganshin wrote:

Sunday, June 27, 2010, 11:07:47 AM, you wrote:

Currently, FilePath is an alias for String.  Changing FilePath to a real
type

Just do not change FilePath, what may be simpler?

if FilePath will become abstract type, it will break all programs
that use it since they use it as String

Hello, do you read me? I said: do not change FilePath.

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-27 Thread Roman Beslik

 On 27.06.10 10:18, Bulat Ziganshin wrote:

Hello Roman,

Sunday, June 27, 2010, 11:11:59 AM, you wrote:


No! The target encoding is the current locale. It is a no-brainer to

not necessarily. current locale, encoding of current terminal and
encoding of every filesystem mounted are all different things

And we should stick to the current locale. Problem solved.
6.3  CString
The module CString provides routines marshalling Haskell into C strings 
and vice versa. The marshalling converts each Haskell character, 
representing a Unicode code point, to one or more bytes in a manner 
that, by default, is determined by the *current locale*.

The Haskell 98 Foreign Function Interface.

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Roman Beslik



On 25.06.10 20:09, Jason Dagit wrote:


you got everything right here. So, as you said, there is a mismatch
between representation in Haskell (list of code points) and
representation in the operating system (list of bytes), so we need to
know the encoding. Encoding is supplied by the user via locale
(https://secure.wikimedia.org/wikipedia/en/wiki/Locale), particularly
LC_CTYPE variable.

The problem with encodings is not new -- it was already solved
e.g. for
input/output.


This is the part where I don't understand the problem well.  I thought 
that with IO the program assumes the locale of the environment but 
that with filepaths you don't know what locale (more specifically 
which encoding) they were created with.  So if you try to treat them 
as having the locale of the current environment you run the risk of 
misunderstanding their encoding.


Incorrect encoding of filepaths is common in e.g. Cyrillic Linux 
(because of multiple possible encodings --- CP1251, KOI8-R, UTF-8) and 
is solved by fiddling with the current locale and media mount options. 
No need to change a program, or to tell character encoding to a program. 
It is not a programming language issue.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Roman Beslik

 On 26.06.10 16:34, Alexey Khudyakov wrote:

On Sat, 26 Jun 2010 10:14:50 -0300
Felipe Lessafelipe.le...@gmail.com  wrote:

On Sat, Jun 26, 2010 at 05:01:06PM +0400, Bulat Ziganshin wrote:

but what you propose cannot be used in Windows at all! while current
FilePath still works on Unix, with manual filenames en/decoding

Now we got back on topic! :)

The FilePath datatype is OS-dependent and making it abstract
should be at least a first step.  If you got it from somewhere
else where it is already encoded, then fine.  If you need to
construct it, then you need to use a smart constructor.  If you
need to show/print it, then you need to convert it to String.
And so on.


It should solve most of problems I believe. But such change will break
a lot of programs maybe most of them. How could one introduce such a
change? One variant is to create new hierarchy and gradually deprecate
old.
I fail to see how it will brake programs. Current programs do not use 
Unicode because it is implemented incorrectly.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Core packages and locale support

2010-06-26 Thread Roman Beslik

 On 26.06.10 15:44, Felipe Lessa wrote:

On Sat, Jun 26, 2010 at 09:29:29AM +0300, Roman Beslik wrote:

Incorrect encoding of filepaths is common in e.g. Cyrillic Linux
(because of multiple possible encodings --- CP1251, KOI8-R, UTF-8)
and is solved by fiddling with the current locale and media mount
options. No need to change a program, or to tell character encoding
to a program. It is not a programming language issue.

If your program saves files using filepaths given by the user or
created programatically from another filepath, then you don't
need to decode/encode anything and the problem isn't in the
programming language.

However, suppose your program needs to create a file with a name
based on a database information.  Your database is UTF-8.  How do
you translate that UTF-8 data into a filepath?  This is the
problem we got in Haskell.  We have a nice coding-agnostic String
datatype, but we don't know how to create a file with this very
name.
It is simple — you recode from (database | network server | file) 
encoding to the current locale.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCi and State

2010-06-25 Thread Roman Beslik

 On 25.06.10 12:07, corentin.dup...@ext.mpsa.com wrote:

2. For now, the game is more or less playable in GHCi. But my concern is:
When you use GHCi, you are in the IO monad, right? How to had state to this
monad?
I would like that the player can compose his rule in GHCi, and when he is
done, he can submit it in GHCi with something like:

*Nomic  submitRulemyrule
You can store a set of rules in IORef or another IO-mutable type. I 
think you are in the IO monad is pretty vague. Obviously, GHCi runs 
pure computations also.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: getting Core Haskell from GHC API with cross-module inlinings

2010-06-21 Thread Roman Beslik



On 21.06.10 21:45, Tim Chevalier wrote:

Also, I don't know what you're trying to do, but I recommend looking
at GHC's External Core feature:
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/ext-core.html
and at the extcore and linkcore libraries:
http://hackage.haskell.org/package/extcore
http://hackage.haskell.org/package/linkcore
   

Thanks, Tim. I will look into it.

I'm trying to:
- get source code on different stages of processing in GHC;
- dig to the GHC function which is responsible for some alteration in a 
source code.
It is hard to trace a link between source code appearing as values in 
GHC functions and what -ddump-simpl outputs. And I guess that 
-ddump-simpl provides too coarse control of source code processing. So 
I try to call GHC functions directly. It is important that source code 
processing in GHC and libraries you mentioned (and the ghc library) 
should be identical.


--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] HaskellWiki and Wikipedia

2010-06-21 Thread Roman Beslik

On 17.06.10 23:44, Ketil Malde wrote:

Roman Beslikber...@ukr.net  writes:
   

I do not agree. They are not confused by other languages, they treat
all languages as born equal.
 

Are you saying this is a good thing?
   

Yes. There is more than Haskell.

E.g the article on generic programming mainly talks about parametric
polymorphism.
Generic programming is a bad term so I do not care if it is used in 
the Haskell sense or in the Wikipedia sense. It should not be used at all.

The article on type systems starts off with some
definitions by Cardelli, but goes on to discuss so-called dynamic type
systems, which are an entirely different thing.
   
Do we read different Wikipedia-s? Wikipedia article Type system 
discussed all kinds of type system, including dependent, linear, 
intersection. Yes, dynamic typing is a type system. Sorry, dear, I 
forgot you did not like it.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Modules and their explicit export lists (are an annoyance)

2010-06-19 Thread Roman Beslik
Hi, Christian. Here is my humble and somewhat vague thoughts. I think 
that export list is reasonable for commonly used and stable (ancient) 
library. Export list is a contract between library's author and user. 
Though current Haskell rules force author to have one and only one 
contract with all the people in the world. E.g. in law there is no such 
restriction. Assuming that (using/not using) an unstable function in the 
library is responsibility of library's user (not author), there may be:

- declaration import hidden for importing everything;
- compiler option for banning import hidden;
- several export lists (in separate files) for different type of users.
On 19.06.10 21:38, Christian Höner zu Siederdissen wrote:

Hi everybody,

I'd like some input on other peoples' thoughts on this. Recently, I
played around with a library that uses an explicit export list.
…
But the more important thing is, that it makes extending module
functionality a pain (eg. if a constructor is not exported using (..)).
So, should I really fork a library just to be able to add a function?
   

--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] HaskellWiki and Wikipedia

2010-06-18 Thread Roman Beslik

On 18.06.10 07:41, Jason Dagit wrote:
On Thu, Jun 17, 2010 at 6:36 AM, Roman Beslik ber...@ukr.net 
mailto:ber...@ukr.net wrote:


I mean that a link [[X]] leads to HaskellWiki if X exists in
HaskellWiki and to Wikipedia otherwise.


I think this is probably a bad idea.  Imagine trying to create a new 
page on the haskellwiki when wikipedia already has an article by the 
same name.
O'kay, [[X]] leads to a page with links Create the page X and Go to 
Wikipedia.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


getting Core Haskell from GHC API with cross-module inlinings

2010-06-17 Thread Roman Beslik

Hi.
The following code compiles A.hs with GHC API:
{{{
import GHC
import Outputable
import DynFlags ( defaultDynFlags )
libdir = /usr/lib/ghc-6.12.1
targetFile = A.hs
main = defaultErrorHandler defaultDynFlags $ do
runGhc (Just libdir) $ do
dflags - fmap (\dflags - dflags {optLevel = 2}) 
getSessionDynFlags

setSessionDynFlags dflags
c - compileToCoreSimplified targetFile
print (showSDoc (ppr c))
}}}
A.hs: {{{
import Data.Maybe
main = print (show (maybe False (\_ - True) (Just False)))
}}}
When A.hs is compiled with GHC API, output contains a reference to 
'maybe'. When A.hs is compiled with ghc -O2 -ddump-simpl, 'maybe' is 
inlined and simplified. Why do outputs differ?


--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] HaskellWiki and Wikipedia

2010-06-17 Thread Roman Beslik
I mean that a link [[X]] leads to HaskellWiki if X exists in HaskellWiki 
and to Wikipedia otherwise. Interwiki links requires to change all 
occurrences of [[X]] when X is created.
|[[wikipedia:|{{PAGENAME}}|]]| may be handy on existing pages, it 
provides a link to additional material.


On 17.06.10 03:11, Jason Dagit wrote:
Both use the mediawiki engine.  I know at one point mediawiki 
supported a notion of interwiki links.  Perhaps this feature still 
exists and would give a way for us to more naturally link to wikipedia 
articles?


http://www.mediawiki.org/wiki/Help:Links#Interwiki_links


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaskellWiki and Wikipedia

2010-06-17 Thread Roman Beslik
I do not agree. They are not confused by other languages, they treat all 
languages as born equal. Do not forget, mathematics is the common source 
of knowledge for all programmers, creating our separate source of 
knowledge leads to isolationism and narrow-minded vision. If my words 
are too vague — catamorphism and F-algebra belong to mathematics, 
not to Haskell.


Maybe Wikipedia articles are bad because they are provided by community 
— then HaskellWiki will suffer likewise. :(


On 16.06.10 23:19, Ketil Malde wrote:

Edward Kmettekm...@gmail.com  writes:
   

I realize that this is addressing the symptom, not the cause
 

I'm not so sure Wikipedia is a good source of information for this.
I've tried to read some of their articles on e.g. type systems or
generic programming, but they tend to be confused by other languages and
their communities using these terms to mean different things.  So I
think it is better to build on the HaskellWiki where the words can mean
what we want them to.
   


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Understanding GHC allocations

2010-06-17 Thread Roman Beslik

On 17.06.10 12:40, Roman Cheplyaka wrote:

 From reading core I got the impression that everything is strict
unboxed. Perhaps this is related to creating some closures? How to get
rid of those allocations?
   
Yes, distance creates a closure of type @Double - Double# - Double@ 
which is obviously not necessary. I do not know why.



2. Again from reading the core I learned that although 'l' and other
constants are inlined, their type is boxed Double. This makes sense
since CAFs are evaluated on demand, but obviously in this particular
case it does not make sense, so can I somehow make them unboxed
Hmm, I learned from -ddump-core that distance function uses constant 
25.0.


There is another way to optimize — make GHC use floating point abs 
processor instruction. Now it uses

{{{
abs x | x = 0.0 = x
| otherwise = negateDouble x
}}}
http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/GHC-Float.html

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Mapping a list of functions

2010-06-17 Thread Roman Beslik

map (\function - function argument) functions
map ($ argument) functions

map (\firstArgument
 -  function firstArgument secondArgument thirdArgument) xs


On 17.06.10 22:02, Martin Drautzburg wrote:

Hello all

The standard map function applies a single function to a list of arguments.
But what if I want to apply a list of functions to a single argument. I can
of course write such a function, but I wonder if there is a standard way of
doing this,

Related to that is the problem, that the function in map may require more than
one argument, so I need to apply it partially to some value(s) first. But
what if I want to fix its second and third argument and not its first
argument? Can flip help


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Understanding GHC allocations

2010-06-17 Thread Roman Beslik

On 17.06.10 19:12, Roman Beslik wrote:

On 17.06.10 12:40, Roman Cheplyaka wrote:

 From reading core I got the impression that everything is strict
unboxed. Perhaps this is related to creating some closures? How to get
rid of those allocations?
Yes, distance creates a closure of type @Double - Double# - 
Double@ which is obviously not necessary. I do not know why. 

-funfolding-use-threshold=7 removes that closure.

--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HaskellWiki and Wikipedia

2010-06-16 Thread Roman Beslik
Hi all. There are some notions which are not described in HaskellWiki 
but described in Wikipedia, e.g. catamorphism. When clicking on a link 
[[catamorphism]] that leads to create a new page it would be nice to 
show link to a corresponding Wikipedia page. Also search in Wikipedia 
on the search results page.


--
Best regards,
  Roman Beslik.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: laziness in `length'

2010-06-15 Thread Roman Beslik

On 14.06.10 17:25, Serge D. Mechveliani wrote:

  lng [1 .. n] =
  lng (1 : (list 2 n)) =  1 + (lng $ list 2 n) =
  1 + (lng (2: (list 3 n))) = 1 + 1 + (lng $ list 3 n) = {- !!! -}
  2 + (lng (3: (list 4 n)))   -- because this + is of Integer
  = 2 + 1 + (lng $ list 4 n) = {- !!! -}
  3 + (lng $ list 4 n)
   
Actually matters are more complicated. In the highlighted steps you 
implicitly used associativity of (+). Of course, Haskell can not do 
this. Also 'lng' and 'genericLength' *are not tail recursive*. This 
explains stack overflow. If you compute length with 'foldl' 
(tail-recursively) and without -O flag, than you will see excessive 
heap usage. Also, GHC's 'length' and 'foldl'' are tail recursive and 
eagerly computes length/accumulator, so they are effective without -O 
flag. See for explanation

http://www.haskell.org/haskellwiki/Stack_overflow

--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ld memory usage

2010-04-18 Thread Roman Beslik
I've tried. First error was that gold does not recognize -pthread 
option. If I remove -pthread, gold complains about many undefined 
references, strlen for instance. So, I did not succeed. I guess that 
GHC and gold need adjustments to work together.


On 18.04.10 09:20, David Terei wrote:

You could also have a look at the new 'Gold' linker that's part of
binutils.
   


--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ld memory usage

2010-04-18 Thread Roman Beslik
Thank you very much. With your patch ld eats 3 times less resident 
memory when compiling Hackage packages.
If someone here uses Arch Linux, I uploaded patched binutils to AUR 
with the name binutils-tune-bfd-hash.


On 17.04.10 16:59, Bertram Felgenhauer wrote:

I've been running binutils with this patch,

 http://int-e.home.tlink.de/haskell/binutils-2.18-tune-bfd-hash.patch
 (still applies to 2.20)
   


--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


ld memory usage

2010-04-16 Thread Roman Beslik

Hi.
This is not strictly a GHC question. I observed that ld when linking 
GHC-compiled programs eats 0.5 GB of resident memory. ~3 times more than 
GHC or Haddock. So if there is not enough free memory ld uses virtual 
memory and works very slowly (practically does not use CPU). I'd like to 
know, is anyone interested in researching and improving memory usage? Is 
it ld or GHC problem? I found a similar discussion here

http://article.gmane.org/gmane.comp.lang.haskell.cafe/66189
but it was too broad and went nowhere.

--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: strictness of unused arguments

2010-03-12 Thread Roman Beslik
Thanks for the answer. Sorry, I can not follow all of your thoughts 
because my knowledge of strictness analysis and GHC optimizations are 
very basic. :( I looked into GHC code once several years ago. BTW there 
are a lot of papers about strictness analysis, but I do not know which 
is relevant for GHC. Can you suggest something?


On 11.03.10 23:33, Max Bolingbroke wrote:

On 11 March 2010 12:50, Roman Beslikber...@ukr.net  wrote:
   

I also can force the analyzer to think that x1 and x0 are strict by
eta-expanding f3:
 

There seem to be two issues here.

1) GHC only figures out and records strictness information on lambdas
that are syntactically together. I'm not sure how hard it would be to
change this, but probably not totally straightforward
   
So GHC records strictness information for lambda-abstractions, not for 
function types? Eta-expansion changes strictness because it adds 
lambda-abstractions.

2) GHC does not seem to be eta-expanding as much as it could get away
with. Generally eta expansion has the following effects
   
I think it is better to go without eta-expansion. Eta-expansion (if not 
optimized when compiled) do absolutely useless job. I discovered its 
effect by an accident.

Out of curiosity, did you spot this in a real program?
   
It may be a real program. :) From the higher-level point of view: A list 
of Int-s is replaced by seed+coalgebra and a coalgebra is an automaton. 
The program generates lists and folds them, or in other words the 
program is a sequence of automata which feeds each other. The special 
feature is that states of all automata lay in stack, the program *does 
not allocate in the heap*. Of course, if it uses boxed Int-s, the very 
goal is missed. :( However, for now I can compose automata only by hand 
:( , I did not figured out a (.) function.


--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: strictness of unused arguments

2010-03-12 Thread Roman Beslik

Thanks again.

On 12.03.10 15:38, Max Bolingbroke wrote:

There is nothing *published* (Simon has a half-written one lying
around though), but the general approach is similar to that shown in
Projections for strictness analysis at
http://homepages.inf.ed.ac.uk/wadler/topics/strictness-analysis.html.
Unfortunately the weird behaviour you are seeing is due to the demand
transformer technology of GHC, which is one of the unpublished
bits...
   



--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


strictness of unused arguments

2010-03-11 Thread Roman Beslik

Hi all.

I provide a sample program which causes a strange behavior of strictness 
analyzer.

variant 1 {{{
module StrictUnusedArg (main) where
f2 :: Int - Int - Int
f2 x1 = if x1 == 0 then (\x0 - x0) else let
y = x1 - 1
in f3 y y
f3 :: Int - Int - Int - Int
f3 x2 = if x2 == 0 then f2 else let
y = x2 - 1
in f4 y y
f4 :: Int - Int - Int - Int - Int
f4 x3 = if x3 == 0 then f3 else let
y = x3 - 1
in \x2 x1 x0 - f4 y x2 x1 (y + x0)
main = print (f2 100 0)
}}}
I expect that all arguments will be unboxed. -ddump-simpl reveals that 
actually types are

{{{
f2 :: Int# - Int - Int
f3 :: Int# - Int - Int - Int
}}}
So when f3 calls f2 it unboxes the argument named x1 and when f2 
calls f3 it boxes the argument named x1. -ddump-stranal knows 
strictness only for the x2 of f3 and x1 of f2.

{{{
f2:
[Arity 1
 Str: DmdType U(L)]
f3:
[Arity 1
 Str: DmdType U(L)]
}}}
I also can force the analyzer to think that x1 and x0 are strict by 
eta-expanding f3:

variant 2 {{{
f3 x2 x1 x0 = if x2 == 0 then f2 x1 x0 else let
y = x2 - 1
in f4 y y x1 x0
}}}
-ddump-stranal yields:
{{{
f3:
[Arity 3
 Str: DmdType U(L)U(L)U(L)m]
f2:
[Arity 2
 Str: DmdType U(L)U(L)m]
}}}
I even do not use ($!).
So, the questions: Is it possible to change the strictness analyzer so 
it will treat variant 1 as variant 2? Are these changes big?


Compiled with options:
$ ghc --make -fstrictness -fPIC -O3 -fforce-recomp blah-blah-blah
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1

--
Best regards,
  Roman Beslik.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users