Re: [Haskell-cafe] Yet Another Forkable Class

2013-08-24 Thread Ozgur Akgun
Hi.

On 23 August 2013 13:29, Nicolas Trangez nico...@incubaid.com wrote:

 Did anyone ever consider using type-level literals (strings) to 'name'
 effects (or transformer layers when using monad stacks)?


Edwin Brady had this in his effects library in Idris.
http://www.idris-lang.org/documentation/effects/

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


Re: [Haskell-cafe] llvm on macos

2013-08-15 Thread Ozgur Akgun
Hi.

On 15 August 2013 20:35, Carter Schonwald carter.schonw...@gmail.comwrote:

 Just brew install llvm should work fine.


I wonder what makes you think this is the case.

At this moment in time, `brew install llvm` will install llvm-3.3.
Using llvm-3.3, I get warnings and errors. Using llvm-3.2, I get warnings
but I never got any errors. This is not to say that they cannot happen on
other packages.

I've just uninstalled 3.2, installed 3.3, and tried to compile a project of
mine. One of its dependencies, data-default-class, failed to compile.
The following is what happened on my computer.

Hope this helps,
Ozgur.


$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
$ cabal install --force-reinstalls --disable-documentation
--disable-library-profiling --disable-executable-profiling
 --ghc-options=-fllvm data-default-class
Resolving dependencies...
Configuring data-default-class-0.0.1...
Building data-default-class-0.0.1...
Preprocessing library data-default-class-0.0.1...
[1 of 1] Compiling Data.Default.Class ( Data/Default/Class.hs,
dist/build/Data/Default/Class.o )
You are using a new version of LLVM that hasn't been tested yet!
We will try though...
wrong initalizer for intrinsic global variable
[0 x i8*] undef
Broken module found, compilation aborted!
0  libLLVM-3.3.dylib 0x00010223faee
llvm::sys::PrintStackTrace(__sFILE*) + 40
1  libLLVM-3.3.dylib 0x00010223fef5 SignalHandler(int) + 241
2  libsystem_c.dylib 0x7fff8601f94a _sigtramp + 26
3  libsystem_c.dylib 0x000102a10a00 _sigtramp + 2090799312
4  libLLVM-3.3.dylib 0x00010223fd6d abort + 22
5  libLLVM-3.3.dylib 0x000101f08466 (anonymous
namespace)::Verifier::abortIfBroken() + 236
6  libLLVM-3.3.dylib 0x000101f07b97 (anonymous
namespace)::Verifier::doFinalization(llvm::Module) + 3477
7  libLLVM-3.3.dylib 0x000101ef63a4
llvm::FPPassManager::doFinalization(llvm::Module) + 56
8  libLLVM-3.3.dylib 0x000101ef5e52
llvm::FunctionPassManagerImpl::doFinalization(llvm::Module) + 62
9  libLLVM-3.3.dylib 0x000101ef5d43
llvm::FunctionPassManager::doFinalization() + 21
10 opt   0x000101be19aa
std::vectorstd::pairllvm::BasicBlock*,
llvm::SuccIteratorllvm::TerminatorInst*, llvm::BasicBlock ,
std::allocatorstd::pairllvm::BasicBlock*,
llvm::SuccIteratorllvm::TerminatorInst*, llvm::BasicBlock  
::_M_insert_aux(__gnu_cxx::__normal_iteratorstd::pairllvm::BasicBlock*,
llvm::SuccIteratorllvm::TerminatorInst*, llvm::BasicBlock *,
std::vectorstd::pairllvm::BasicBlock*,
llvm::SuccIteratorllvm::TerminatorInst*, llvm::BasicBlock ,
std::allocatorstd::pairllvm::BasicBlock*,
llvm::SuccIteratorllvm::TerminatorInst*, llvm::BasicBlock,
std::pairllvm::BasicBlock*, llvm::SuccIteratorllvm::TerminatorInst*,
llvm::BasicBlock  const) + 6988
11 libdyld.dylib 0x7fff8959c7e1 start + 0
12 libdyld.dylib 0x0006 start + 1990604837
Stack dump:
0. Program arguments: opt
/var/folders/h5/3mmbxydn5qs3w9f3j6mgmhscgn/T/ghc11789_0/ghc11789_0.ll
-o
/var/folders/h5/3mmbxydn5qs3w9f3j6mgmhscgn/T/ghc11789_0/ghc11789_0.bc
-O1 --enable-tbaa=true
llc:
/var/folders/h5/3mmbxydn5qs3w9f3j6mgmhscgn/T/ghc11789_0/ghc11789_0.bc:
error: Could not open input file: No such file or directory
Failed to install data-default-class-0.0.1
cabal: Error: some packages failed to install:
data-default-class-0.0.1 failed during the building phase. The exception
was:
ExitFailure 1
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] llvm on macos

2013-08-11 Thread Ozgur Akgun
On 11 August 2013 17:48, Dominic Steinitz domi...@steinitz.org wrote:

 I seem to be running LLVM 3.2 so I am a bit puzzled by the warning. Is it
 because I am running ghc 7.6.2?


I get the warning too, but nothing seems to be broken with 3.2. This is
what I meant to say, sorry if I was confusing.


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


Re: [Haskell-cafe] llvm on macos

2013-08-10 Thread Ozgur Akgun
Hi.

On 10 August 2013 18:20, Brandon Allbery allber...@gmail.com wrote:

 There may be some support for requesting specific versions from Homebrew.


Try `brew versions llvm`. Then, you'll need to run the git checkout command
in `brew --prefix` directory.

I am using llvm 3.2 because I had a few ghc related problems with llvm 3.3.
Never had any problems with 3.2 though.

Hope this helps,
Ozgur
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Casting newtype to base type?

2013-07-06 Thread Ozgur Akgun
Hi Vlatko.

On 2 July 2013 16:03, Vlatko Basic vlatko.ba...@gmail.com wrote:

 Is there a nicer way to extract the 'IO String' from 'IOS',
 without 'case' or without pattern matching the whole 'P'?


You might enjoy the newtype package.

http://hackage.haskell.org/package/newtype

Hope this helps,
Ozgur.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] TH clause Pat selection

2013-06-20 Thread Ozgur Akgun
Hi.

On 19 June 2013 23:23, Brian Lewis br...@lorf.org wrote:

 The problem is, I don't know how to generate the function's clauses.
 foo 0 = ... seems to be a LitP pattern. But foo True = ... seems to
 be a ConP pattern. The appropriate pattern depends on type c.


I've used haskell-src-meta for this purpose before. See:

http://hackage.haskell.org/packages/archive/haskell-src-meta/0.6.0.2/doc/html/Language-Haskell-Meta-Parse.html#v:parsePat

Hope this helps,
Ozgur
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Backward compatibility

2013-05-03 Thread Ozgur Akgun
Hi,

On 3 May 2013 11:43, Tobias Dammers tdamm...@gmail.com wrote:

  PS The proposal to fix Functor = Applicative = Monad has patches
  attached for GHC and base, but the backwards compatibility bogeyman
  always seems to trump something that will break a lot of code.

 This kind of breaks everything changes would require something similar
 to what Python is doing with the 2 - 3 transition, and considering how
 painfully slowly it is progressing there, I understand perfectly well why
 people don't want to go there.


There is one very big advantage in the Haskell-world though.
Most of the struggle will be at the compile time. The biggest headache
caused by
the Python 2 - 3 transition is how you get a runtime error 2 weeks after
you think
you've fixed everything!

(Yeah, I know code coverage analysis is an option when you don't have static
type checking, but ...)

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


Re: [Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs

2013-04-27 Thread Ozgur Akgun
Hi,

On 27 April 2013 10:07, Alberto G. Corona agocor...@gmail.com wrote:

 I created a ticket for the feature request:

 Ticket #7870

 Teachers, newbies and people working in Industry: Please push it!


A link to the ticket may be helpful for the lazy.

http://hackage.haskell.org/trac/ghc/ticket/7870

I quite like this idea, and I think this is one thing people use TH for now
instead.
(Using quasi-quotes, you can produce any compilation error you like...)
It would be great if we didn't have to pull in the full power of TH (or QQ)
for this.


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


[Haskell-cafe] cabal install choosing an older version

2013-01-25 Thread Ozgur Akgun
Hi,

I noticed a weird behaviour with cabal-install. When I run `cabal install
hspec --dry-run -v` cabal-install correctly picks hspec-1.4.3 (the latest
version).

However, when I run `cabal install ansi-terminal hspec --dry-run
-v`cabal-install tries to install hspec-0.3.0 for no apparent reason.

This is with a clean user package db.

Following is some info about my system.


$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.1

$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0.3 of the Cabal library

$ ghc-pkg list --user

$ cabal install hspec --dry-run -v
Reading available packages...
Choosing modular solver.
Resolving dependencies...
In order, the following would be installed:
HUnit-1.2.5.1 (new package)
ansi-terminal-0.5.5.1 (new package)
hspec-expectations-0.3.0.3 (new package)
random-1.0.1.1 (new package)
QuickCheck-2.5.1.1 (new package)
setenv-0.1.0 (new package)
silently-1.2.4.1 (new package)
transformers-0.3.0.0 (new package)
hspec-1.4.3 (new package)

$ cabal install ansi-terminal hspec --dry-run -v
Reading available packages...
Choosing modular solver.
Resolving dependencies...
In order, the following would be installed:
HUnit-1.2.5.1 (new package)
ansi-terminal-0.6 (new package)
extensible-exceptions-0.1.1.4 (new package)
random-1.0.1.1 (new package)
QuickCheck-2.5 (new package)
hspec-0.3.0 (new package)



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


Re: [Haskell-cafe] cabal install choosing an older version

2013-01-25 Thread Ozgur Akgun
Aha!

I think I know why this happens.

The latest versions of ansi-terminal and hspec do not work together. Cabal
picks the latest ansi-terminal (0.6) first, then the latest hspec that
doesn't conflict with this choice is 0.3.0.

I can confirm this by the following:

$ cabal install hspec ansi-terminal --dry-run -v
Reading available packages...
Choosing modular solver.
Resolving dependencies...
In order, the following would be installed:
HUnit-1.2.5.1 (new package)
ansi-terminal-0.5.5.1 (new package)
hspec-expectations-0.3.0.3 (new package)
random-1.0.1.1 (new package)
QuickCheck-2.5.1.1 (new package)
setenv-0.1.0 (new package)
silently-1.2.4.1 (new package)
transformers-0.3.0.0 (new package)
hspec-1.4.3 (new package)

When hspec comes before ansi-terminal, the latest version for hspec is
selected and an older version of ansi-terminal is used.

Maybe cabal-install should backtrack more and pick a *more optimal *set of
latest versions, I don't know. If this is desired, a proximity of the
selected versions to the latest available versions might be a good measure.

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


Re: [Haskell-cafe] cabal install choosing an older version

2013-01-25 Thread Ozgur Akgun
Hi Max,

On 25 January 2013 15:58, Max Bolingbroke batterseapo...@hotmail.comwrote:


 If this happens because the dependency bounds of ansi-terminal are too
 tight then please send me a patch.


No, actually it happens because hspec depends on ansi-terminal-0.5.*.

I am cc'ing Simon Hengel, the maintainer of hspec so he is aware of this.

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


Re: [Haskell-cafe] Quickcheck

2012-11-13 Thread Ozgur Akgun
hi,

On 13 November 2012 21:52, gra...@fatlazycat.com wrote:

 prop_something x y = ...do blah with positive integers
   == x  0  y  0


quickcheck provides a few nice new types for such cases. try:

prop_something (Positive x) (Positive y) = ...

this way qc only generates positive numbers, instead of generating and
discarding some.

hth,

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


Re: [Haskell-cafe] Is there a tool to see reduction steps?

2012-10-10 Thread Ozgur Akgun
Hi Daryoush,

You could add another case to label, importing Debug.Trace:

data Tree = Leaf | Node Tree Int Tree deriving Show

*label t | trace (show $ label  ++ show t) False = undefined*

 label (Node ln _ rn) ((h:r):rest) = (Node lr h rr, r:r2) where

 (lr, r1) = label ln rest

 (rr, r2) = label rn r1

 label _ _  = (Leaf, [])

 lt t = let (r, unused) = label t ([1..]:unused)
   in r

This will output one line per each call to label. Except for one thing:
your show function will never actually terminate, if the tree is cyclic.
You can fix this by defining your own show function.

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


Re: [Haskell-cafe] a parallel mapM?

2012-10-07 Thread Ozgur Akgun
Hi,

On 3 October 2012 19:23, Ryan Newton rrnew...@gmail.com wrote:

 That said, I don't see a reason for not including a separate version of
 runParIO :: ParIO a - IO a for non-deterministic computations. It seems
 really useful!


 Exactly.  I should have been more explicit but that's what I meant about
 adding another module.  You would import Control.Monad.Par.IO and get
 runParIO + liftIO but NOT runPar.  This requires doing a newtype over Par
 to create the liftIO instance for one and not the other (and preserve Safe
 Haskell).  It's a pain but it's no problem.  Both types
 Control.Monad.Par.Par and Control.Monad.Par.IO.ParIO will expose the same
 interface (i.e. have instances of the same classes -- ParFuture,
 ParIVar...), so generic algorithms like parMap will still work for either.

   -Ryan


This sounds like a great idea, I just wanted to ask if anyone is working on
it or not?

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


Re: [Haskell-cafe] Discovery of unnecessary build-depends

2012-09-29 Thread Ozgur Akgun
On 28 September 2012 19:29, Jason Whittle ja...@funnelfire.com wrote:

 Is there a tool available that will tell me if the cabal file for my
 library or application has any unnecessary build-depends?


FWIW, I felt the need for such a tool many times before too.

The same tool can also report outdated dependencies, maybe?

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


Re: [Haskell-cafe] Printing call site for partial functions

2012-04-25 Thread Ozgur Akgun
Hi,

On 25 April 2012 16:36, Michael Snoyman mich...@snoyman.com wrote:

Prelude.head: empty list


Recent versions of GHC actually generate a very helpful stack trace, if the
program is compiled with profiling turned on and run with -xc.

See: http://community.haskell.org/~simonmar/slides/HIW11.pdf(Ironically
titled Prelude.head: empty list)

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


Re: [Haskell-cafe] adding the elements of two lists

2012-03-29 Thread Ozgur Akgun
On 29 March 2012 04:34, Richard O'Keefe o...@cs.otago.ac.nz wrote:

 u f (PS x)= PS $ map f x
 b f (PS x) (PS y) = PS $ zipWith f x y
 to_ps x   = PS (x : repeat 0)


Also see: http://hackage.haskell.org/package/newtype

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


Re: [Haskell-cafe] Are there arithmetic composition of functions?

2012-03-19 Thread Ozgur Akgun
Hi,

If you are feeling adventurous enough, you can define a num instance for
functions:

{-# LANGUAGE FlexibleInstances #-}

instance Num a = Num (a - a) where
f + g = \ x - f x + g x
f - g = \ x - f x - g x
f * g = \ x - f x * g x
abs f = abs . f
signum f = signum . f
fromInteger = const . fromInteger

ghci let f x = x * 2
ghci let g x = x * 3
ghci (f + g) 3
15
ghci (f+g+2) 2
17

HTH,
Ozgur

On 19 March 2012 16:57, sdiy...@sjtu.edu.cn wrote:

 By arithmetic I mean the everyday arithmetic operations used in
 engineering.
 In signal processing for example, we write a lot of expressions like
 f(t)=g(t)+h(t)+g'(t) or f(t)=g(t)*h(t).
 I feel it would be very natural to have in haskell something like
   g::Float-Float
   --define g here
   h::Float-Float
   --define h here
   f::Float-Float
   f = g+h --instead of f t = g t+h t
   --Of course, f = g+h is defined as f t = g t+h t

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


Re: [Haskell-cafe] Are there arithmetic composition of functions?

2012-03-19 Thread Ozgur Akgun
On 19 March 2012 17:43, David Thomas davidleotho...@gmail.com wrote:

 The 17 at the end should be 12, or the 2 passed into (f+g+2) should be 3.


It was the latter :) Copy/paste error, sorry.

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


Re: [Haskell-cafe] Are there arithmetic composition of functions?

2012-03-19 Thread Ozgur Akgun
Hi Chris,

On 19 March 2012 17:58, Chris Smith cdsm...@gmail.com wrote:

 On Mar 19, 2012 11:40 AM, Ozgur Akgun ozgurak...@gmail.com wrote:
  {-# LANGUAGE FlexibleInstances #-}
 
  instance Num a = Num (a - a) where

 You don't want (a - a) there.  You want (b - a).  There is nothing about
 this that requires functions to come from a numeric type, much less the
 same one.

Thanks for catching this one, you are absolutely correct. I was carried
away by the original post using Float - Float for the example functions.

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


[Haskell-cafe] cabal test-suite library recompilation

2012-03-13 Thread Ozgur Akgun
Hi all,

I've recently started to move my tests to use the new cabal test-suite
framework.

Old setup:
The cabal file compiles one library + a few executables. The library
contains almost all of the code and exposes the necessary modules for use
by the executables. The executables mainly consist of one main file. This
way, the library is only compiled once and used multiple times by the
executables. Great.
One of the executables compile a test runner, and is handled similarly.

New setup, using test-suite:
I've deleted the executable section for the test runner and added a
test-suite section instead. To my surprise, the library is compiled twice
now. Hence, it takes twice as long. And it is a clear regression compared
to my old setup.

While waiting for a build to finish [ :) ], I just wanted to write an email
and check if this is intentional or only an oversight. Or maybe a technical
limitation for the time being?

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


Re: [Haskell-cafe] cabal test-suite library recompilation

2012-03-13 Thread Ozgur Akgun
On 13 March 2012 16:22, Antoine Latter aslat...@gmail.com wrote:

 If your library code and test code are in separate sub-directories and
 you reference your library as a package dependency for your test then
 Cabal won't re-build your library.


Yay! That was it. Thanks.

Somehow I altered the hs-source-dir field while moving from the old setup
to the new setup. So just to confirm, the behaviour of the test-suite
section is exactly the same as that of executable sections.

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


Re: [Haskell-cafe] Prettier pretty-printing of data types?

2012-03-13 Thread Ozgur Akgun
I prefer pretty-show rather than groom as it's output is hierarchical.

http://hackage.haskell.org/package/pretty-show

Ozgur

On 13 March 2012 22:37, Austin Seipp mad@gmail.com wrote:

 It's not exactly hierarchical, but Groom most certainly should help
 with getting much prettier output:

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


Re: [Haskell-cafe] Finally, a pure iteratee library that deals with errors

2012-02-26 Thread Ozgur Akgun
I didn't really look into (enumerators/iteratees/conduits/etc)-land closely
enough, but I can say one thing. The code you link to is very easy to
understand and see what is going on. This must be a good thing.

On 26 February 2012 10:50, Daniel Waterworth da.waterwo...@gmail.comwrote:

 There's seems to be a growing trend amongst the Haskell community for
 writing replacements of enumerator. It's shortcomings are well
 documented,


Where can I find a compilation of their shortcomings?

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


[Haskell-cafe] hackage down

2012-02-18 Thread Ozgur Akgun
Hackage seems to be down:
http://www.downforeveryoneorjustme.com/http://hackage.haskell.org

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


Re: [Haskell-cafe] how to print out intermediate results in a recursive function?

2012-02-03 Thread Ozgur Akgun
Hi,

There is also this nice trick to use Debug.Trace:

merge xs ys | trace (show (xs,ys)) False = undefined -- add this as the
first case to merge
mergesort xs | trace (show xs) False = undefined -- and this as the first
case to mergesort

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


Re: [Haskell-cafe] ghc-api Static Semantics?

2012-01-23 Thread Ozgur Akgun
Hi,

I don't know what you actually need, but if haskell-src-exts is an option,
it is quite a bit easier to use (definitely easier to understand for me!).
Especially when used together with Uniplate.

For example, for a given piece of AST one can get all the identifiers used
like so:

[ x | Ident x - universeBi ast ]

Finding where they are bound shouldn't be very hard either.

Hope this helps,
Ozgur

On 23 January 2012 17:33, Christopher Brown cm...@st-andrews.ac.uk wrote:

 Hi,

 I was wondering if anyone could tell me if it's possible to get an AST
 from the ghc-api decorated with static-semantics?
 In particular, I am interested in use and bind locations for all names in
 the AST together with the module they are bound, etc.

 Looking through the online docs, there doesn't seem to be a way to do this.
 Even if I can tell from the AST where a variable is bound that would be
 enough,  if this is by making all names unique and qualified that would be
 better than nothing.

 Hope someone can help,
 Chris.

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


Re: [Haskell-cafe] Idris

2012-01-20 Thread Ozgur Akgun
Just by looking at the hackage dependencies, it doesn't look like it has
unix-only dependencies. Maybe the Boehm garbage collector?
http://www.hpl.hp.com/personal/Hans_Boehm/gc/

Also, Idris has a mailing list, Edwin would be more likely to respond
there: http://groups.google.com/group/idris-lang

HTH,
Ozgur

On 20 January 2012 19:15, Ryan Ingram ryani.s...@gmail.com wrote:

 Has anyone played with Idris (http://idris-lang.org/) at all?  It looks
 interesting, and I'd love to play with it, but unfortunately I only have
 windows machines up and running at the moment and the documentation seems
 to imply it only builds on unixy systems.

 I'm curious how difficult it would be to get a win32 implementation up and
 running.

   -- ryan


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


Re: [Haskell-cafe] GHC exceeding command line length limit with split-objs - and a possible fix

2012-01-11 Thread Ozgur Akgun
Hi Eugene,

I think I did run into this problem before, and had to turn of split-objs
temporarily to work around it. I'd appreciate a fix.

Best,
Ozgur

On 11 January 2012 14:14, Eugene Kirpichov ekirpic...@gmail.com wrote:

 Now my original question remains - is such a change a good idea?
 (I've already found the place in code where the fix has to be made; should
 take an hour of work at most)

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


Re: [Haskell-cafe] DB vs read/show for persisting large data

2011-12-14 Thread Ozgur Akgun
On 14 December 2011 15:02, Yves Parès limestr...@gmail.com wrote:

 The 'derive' package? The problem is that it has a lot of dependencies you
 maybe don't need if you jut want serialization, plus it relies on TH so it
 grows both compilation time and executable size.


Well you can use the stand alone executable to generate the code for
instances and only ship that with your package. No added dependencies at
all.

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


Re: [Haskell-cafe] How to get a file path to the program invoked?

2011-12-05 Thread Ozgur Akgun
Hi.

On 5 December 2011 14:53, dokondr doko...@gmail.com wrote:

 Main System.Environment.Executable System.FilePath /abc / /
 /

 Instead of getting /abc/ I get /. What am I doing wrong?


It thinks the second path is an absolute path.

Combine two paths, if the second path isAbsolute, then it returns the
second.

http://hackage.haskell.org/packages/archive/filepath/latest/doc/html/System-FilePath-Posix.html#v:combine

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


Re: [Haskell-cafe] cabal install --hyperlink-source ?

2011-12-02 Thread Ozgur Akgun
On 2 December 2011 16:13, Johannes Waldmann waldm...@imn.htwk-leipzig.dewrote:

 but I don't see how to pass options
 from cabal install to  cabal haddock (e.g., --hyperlink-source)


As it seems, it is not possible.

http://stackoverflow.com/questions/2472630/enable-hyperlink-source-for-cabal-install

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


Re: [Haskell-cafe] Using QuickCheck to test against a database

2011-12-01 Thread Ozgur Akgun
Hi!

This looks cool indeed.

On 2 December 2011 00:02, Oliver Charles haskell-c...@ocharles.org.ukwrote:

 [snip] You have to remember to apply all of
 the states of your arbitrary instances, which is a pain, and guaranteed
 to be missed.


Why can't you define a helper function which runs the initDb action while
picking the entity? Something like:

pickDB = do DBState act e - pick arbitrary; act; return e

(placing calls to monadicIO and run appropriately, I am not familiar
enough with the monadic API)

Secondly, the initDb action is sensitive to the order actions are
 sequenced.


Do you mean with respect to other initDb actions?
Why is this? I thought you were using QuickCheck in order not to assume
things about the state of the DB and that the necessary state is prepared
solely by running the initDb action. Is this not the case then?

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


Re: [Haskell-cafe] ANN: Netwire 2.0.0

2011-11-14 Thread Ozgur Akgun
Hi Ertugrul,

Compilation problems here:

cabal install netwire

[ 7 of 22] Compiling Control.Wire.Prefab.Simple (
Control/Wire/Prefab/Simple.hs, dist/build/Control/Wire/Prefab/Simple.o )

Control/Wire/Prefab/Simple.hs:15:7:
Ambiguous occurrence `force'
It could refer to either `Control.Wire.Prefab.Simple.force',
 defined at Control/Wire/Prefab/Simple.hs:41:1
  or `Control.DeepSeq.force',
 imported from Control.DeepSeq at
Control/Wire/Prefab/Simple.hs:24:1-22
cabal: Error: some packages failed to install:
netwire-2.0.0 failed during the building phase. The exception was:
ExitFailure 1

This build was trying to use deepseq-1.2.0.1. It builds fine with
deepseq-1.1.0.2 though.

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


Re: [Haskell-cafe] ANN: Netwire 2.0.0

2011-11-14 Thread Ozgur Akgun
On 14 November 2011 16:33, Ertugrul Soeylemez e...@ertes.de wrote:

 It should be fixed now.  Thanks for your report!


Fixed indeed. Thanks.

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


Re: [Haskell-cafe] Libraries to compare trees?

2011-10-28 Thread Ozgur Akgun
Hi.

On 27 October 2011 13:49, dokondr doko...@gmail.com wrote:

 Please advise on Haskell libraries to compare trees in textual
 representation.
 I need to compare both structure and node contents of two trees, find
 similar sub-trees, and need some metric to measure distance between two
 trees.


This might help: http://hackage.haskell.org/package/gdiff-1.0

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


Re: [Haskell-cafe] Parsec and Text

2011-10-08 Thread Ozgur Akgun
Hi.

See the following for the recent announcement:
http://permalink.gmane.org/gmane.comp.lang.haskell.general/18972

On 8 October 2011 18:37, Yves Parès limestr...@gmail.com wrote:

 Is there a package that allows parsing Text with parsec, ...


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


Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Ozgur Akgun
Hi.

On 1 October 2011 11:55, Yves Parès limestr...@gmail.com wrote:

 BTW Heinrich, the

 evalState (sequence . repeat . State $ \s - (s,s+1)) 0

 at the end doesn't work anymore. It should be replaced by :
 evalState (sequence . repeat . StateT $ \s - Identity (s,s+1)) 0


Or equivalently:

evalState (sequence . repeat . state $ \s - (s,s+1)) 0

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


[Haskell-cafe] Fwd: problem with cabal install MissingH-1.1.1.0

2011-09-22 Thread Ozgur Akgun
Ooops, apparently I forgot to reply to the list. Sorry.

-- Forwarded message --
From: Ozgur Akgun ozgurak...@gmail.com
Date: 22 September 2011 16:49
Subject: Re: [Haskell-cafe] problem with cabal install MissingH-1.1.1.0
To: Mariano Cortesi mcort...@gmail.com


Hi Mariano.


On 22 September 2011 12:48, Mariano Cortesi mcort...@gmail.com wrote:

 I'm with mac OS X lion, ghc version 7.2.1
 and when a i try to install MissingH version 1.1.1.0 it fails with

 [24 of 47] Compiling Data.BinPacking  ( src/Data/BinPacking.hs,
 dist/build/Data/BinPacking.o )

 src/Data/BinPacking.hs:45:6:
 Illegal datatype context (use -XDatatypeContexts): (Num size,


This is weird, because on OS X Lion, and with the following versions, it
doesn't fail for me:

The Glorious Glasgow Haskell Compilation System, version 7.2.1
cabal-install version 0.10.2
using version 1.12.0 of the Cabal library


 Nevertheless, you can try the following to do what cabal asks you to do:

cabal install --ghc-option=-XDatatypeContexts


Which will give a warning, but should succeed anyway.

Hope this helps,
Ozgur



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


[Haskell-cafe] cabal-install to produce a dependency tree

2011-09-14 Thread Ozgur Akgun
Dear Cafe,

What would be the easiest way of generating the following output, given a
package name optionally with additional constraints?

$- foo X  3
X  3 depends on A-2.2, B-1.0, C-1.2
A-2.2 depends on D-1.2.3
...

I assume cabal-install internally does this anyway while creating the
installation plan, so is there an easy way to get this info out of cabal
install?

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


[Haskell-cafe] type profiling not helpful

2011-09-02 Thread Ozgur Akgun
Cafe,

Using prog +RTS -M1G -hy for my program prog, I generate a heap profile as
documented in [1].

There is one big block in the output graph labelled with * though, which
is not very helpful. The star character isn't even mentioned in the
documentation, I wonder what it represents.

Thanks in advance,

[1]
http://www.haskell.org/ghc/docs/latest/html/users_guide/prof-heap.html#rts-options-heap-prof

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


Re: [Haskell-cafe] Unexpected Typeable behaviour; Prelude.undefined

2011-08-28 Thread Ozgur Akgun
Hi Philip,

On 28 August 2011 23:44, Philip Holzenspies p...@st-andrews.ac.uk wrote:

 import Data.Typeable

 data MyADT m = MyADT (m ())

 instance (Typeable1 m, Monad m) = Typeable (MyADT m) where
typeOf t@(MyADT _)
 = mkTyCon MyADT
  `mkTyConApp`
  [typeOf1 ((return :: Monad m = MyADT m - m (MyADT m)) t)]


IIRC, typeOf is supposed to work with undefined as the argument.

Try: typeOf (undefined :: Int)

See:
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Typeable.html#v:typeOf

I think the undefined is merely because the pattern matching you use in the
instance declaration fails.

Hope this helps,
Ozgur
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haddock chokes on function arguments

2011-08-25 Thread Ozgur Akgun
Hi Arnaud,

On 25 August 2011 15:44, Arnaud Bailly arnaud.oq...@gmail.com wrote:

 But then, why is it documented the other way ?


It isn't, as far as I can see. Are we both looking at the same place, namely
section 3.2.3?

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


[Haskell-cafe] haskell-src-exts should depend on happy

2011-08-25 Thread Ozgur Akgun
Hi,

cabal installing haskell-src-exts fails, because of an unlisted dependency
to the happy executable.

The following succeeds:

cabal install happy; cabal install haskell-src-exts

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


Re: [Haskell-cafe] *GROUP HUG*

2011-05-31 Thread Ozgur Akgun
Evan,

On 24 May 2011 19:57, Evan Laforge qdun...@gmail.com wrote:

 On the catMaybes thing, I have a function 'mapMaybe = Maybe.catMaybes
 . map'.  I turns out I only ever used catMaybes after mapping a Maybe
 function, so I hardly ever use catMaybes anymore.  I suppose it should
 have been maybeMap for consistency with concatMap.


Just wanted to point out, that function is already defined in Data.Maybe:

http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Maybe.html#v:mapMaybe

Hugs :)

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


Re: [Haskell-cafe] Hash table constructors return table in IO Monad. Why?

2011-05-12 Thread Ozgur Akgun
On 12 May 2011 20:59, michael rice nowg...@yahoo.com wrote:

 HashTable doesn't do it. Neither does Map. Was I dreaming?


I suppose you could implement this functionality on top of either.

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


Re: [Haskell-cafe] Reformatter for Show

2011-05-02 Thread Ozgur Akgun
Hi Alexey,

On 2 May 2011 21:01, Alexey Khudyakov alexey.sklad...@gmail.com wrote:

 My question is there any tool for reformatting result of show so it could
 be read by human beings?


http://hackage.haskell.org/package/pretty-show

Just use ppShow, instead of show.

Hope this helps,
Ozgur
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Ozgur Akgun
On 25 April 2011 14:11, Angel de Vicente ang...@iac.es wrote:

 curry :: ((a,b) - c) - (a - b - c)


is the same as:

curry :: ((a,b) - c) - a - b - c

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


Re: [Haskell-cafe] 64 bit generic link warning on every compile

2011-04-16 Thread Ozgur Akgun
The -read_only_relocs flag is no longer used on OS X 64, which eliminates
some warnings.

http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/release-7-0-3.html

HTH,
Ozgur

On 16 April 2011 03:47, Andrew Pennebaker andrew.penneba...@gmail.comwrote:

 GHC 7 compiles fine, but there's an additional warning during linking.

 $ system_profiler SPSoftwareDataType | grep System Version
   System Version: Mac OS X 10.6.7 (10J869)
 $ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 7.0.2
 $ cat hello.hs
 #!/usr/bin/env runhaskell

 module Main where

 main :: IO ()
 main = putStrLn Hello World
 $ ghc --make hello.hs
 [1 of 1] Compiling Main ( hello.hs, hello.o )
 Linking hello ...
 ld: warning: -read_only_relocs cannot be used with x86_64
 $ ./hello
 Hello World

 Cheers,

 Andrew Pennebaker
 www.yellosoft.us

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




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


Re: [Haskell-cafe] Fucntion composing

2011-04-11 Thread Ozgur Akgun
In addition to what others have said, you could use pointfree[1] to do this
automagically!

 pointfree h x y = (g 0 (f x y))
h = (g 0 .) . f

[1] http://hackage.haskell.org/package/pointfree

On 11 April 2011 10:22, Adam Krauze ajschy...@mac.com wrote:

 Hello,
 as I am newbie to Haskell  and my introductory question is:

 given functions say f and g with type signatures

 f :: (Num a) = [a] - [a] - [(a,a)]  // f takes two lists and zips them
 into one in some special way
 g :: (Num a) = a - [(a,a)] - [a]  // g using some Num value calculates
 list of singletons from list of pairs

 of course  g 0 :: (Num a) = [(a,a)] -[a]

 now I want to create function h :: (Num a) = [a] - [a] - [a] in such way

 that (g 0) consumes output of f.

 But when I try

 Prelude :t (g 0).f

 I get an error:

 interactive:1:9:
 Couldn't match expected type `[(a0, a0)]'
with actual type `[a1] - [(a1, a1)]'
Expected type: [a1] - [(a0, a0)]
  Actual type: [a1] - [a1] - [(a1, a1)]
In the second argument of `(.)', namely `f'
In the expression: (g 0) . f

 In pointfull representation it works well

 Prelude let h x y = (g 0 (f x y))

 How to do pointfree definition of h?

 Ajschylos.

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




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


[Haskell-cafe] parsec - source position information

2011-04-07 Thread Ozgur Akgun
Hi,

Is there a way to get source position[1] information from parsec while
defining a
parser? It surely knows about source positions, as they are used while
reporting a parsing error.

data Identifier = Identifier String SourcePos

pIdentifier :: Parser Identifier
pIdentifier = do
pos - ??
s   - pString
return (Identifier s pos)

[1]
http://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Text-Parsec.html#t:SourcePos

Thanks in advance,

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


Re: [Haskell-cafe] parsec - source position information

2011-04-07 Thread Ozgur Akgun
Thanks!

On 7 April 2011 16:27, Christopher Done chrisd...@googlemail.com wrote:

 On 7 April 2011 17:22, Ozgur Akgun ozgurak...@gmail.com wrote:

 Is there a way to get source position[1] information from parsec while
 defining a
 parser? It surely knows about source positions, as they are used while
 reporting a parsing error.



 http://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Text-Parsec-Prim.html#v:getPosition
 http://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Text-Parsec-Prim.html#v:getPosition




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


Re: [Haskell-cafe] Question on a common pattern

2011-03-14 Thread Ozgur Akgun
See this thread:
http://www.haskell.org/pipermail/haskell-cafe/2010-October/084291.html

On 14 March 2011 15:48, tsuraan tsur...@gmail.com wrote:

 In my code, I'm doing this quite a lot:

 x - someIO
 case x of
  Opt1 - ...

 Having a line for extracting the value from the IO (or STM) and then
 acting on the value seems unnatural.  Is there a more concise way to
 do this?  This code:

 case someIO of
  Opt1 - ...

 Doesn't work, but is there something like that, that is valid?

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




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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-04 Thread Ozgur Akgun
On 4 March 2011 09:47, Karthick Gururaj karthick.guru...@gmail.com wrote:

 I'm not able to still appreciate the choice of the default ordering order,


I don't know if this will help you appreciate the default or not, but just
to say this default is concordant with the auto-derived Ord instances.

data Tuple3 a b c = Tuple3 a b c
deriving (Eq,Ord,Show)

ghci sort [Tuple3 1 2 4, Tuple3 1 2 3, Tuple3 2 1 1, Tuple3 1 3 5]
[Tuple3 1 2 3,Tuple3 1 2 4,Tuple3 1 3 5,Tuple3 2 1 1]

ghci sort [(1,2,4), (1,2,3), (2,1,1), (1,3,5)]
[(1,2,3),(1,2,4),(1,3,5),(2,1,1)]

No surprises here. Just another place where we have the lexicographic
ordering by default.

HTH,

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


Re: [Haskell-cafe] Noob question about list comprehensions

2011-02-16 Thread Ozgur Akgun
On 16 February 2011 09:19, Tako Schotanus t...@codejive.org wrote:

 I wondered if there was a way for a guard in a list comprehension to refer
 to the item being produced?



 I'm just wondering about this very specific case


Then, the answer is no.

As others have noted, let binding is the way to go.

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


Re: [Haskell-cafe] combined parsing pretty-printing

2011-02-05 Thread Ozgur Akgun
Tillmann,

I've been looking into you packages, very neat ideas and a nice
implementation really.

I've already implemented a toy example and it worked great. Now I am trying
to use your library in a more serious piece of code, and I've realised that
defineIsomorphisms doesn't support record constructors. To be precise, you
handle the case for NormalC in the code, however you do not handle RecC. I
don't think this will be a difficult thing to add. Is there any reason for
you not to support RecC?

Best,

2011/1/26 Tillmann Rendel ren...@informatik.uni-marburg.de

 Hi Ozgur,

 Ozgur Akgun wrote:

 I can write (separately) a parser and a pretty-printer [...]

 Is there any work to combine the two?


 Brent Yorgey wrote:

 Maybe take a look at Invertible Syntax Descriptions: Unifying Parsing
 and Pretty Printing by Tillmann Rendel and Klaus Ostermann from last
 year's Haskell Symposium:

   http://www.informatik.uni-marburg.de/~rendel/unparse/

 It's a beautiful paper, and perhaps the code will work for you
 (although it's too bad it's not on Hackage).


 Indeed, I started this project for exactly the reason Ozgur describes: I
 needed to duplicate a lot of information between parsers and pretty printers
 and was annoyed about it. With invertible syntax descriptions, I now write a
 single program, which looks like a combinator parser (think Parsec), but
 can work as a pretty printer, too.

 I just uploaded the code from the paper (and some additional combinators)
 to Hackage:

  http://hackage.haskell.org/package/partial-isomorphisms
  http://hackage.haskell.org/package/invertible-syntax

 I use this code for the implementation of some very small languages (think
 lambda calculus). This works fine.

 I haven't really tried it for larger languages, but we have two students
 here in Marburg implementing a parser for Java using the library, so we are
 going to have experience with larger languages in a few weeks (months?).

 If you give it a try, I would be happy to receive success stories, bug
 reports, patches, feature requests etc. I want to keep working on this, and
 I am open for suggestions.

  Tillmann


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




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


Re: [Haskell-cafe] combined parsing pretty-printing

2011-02-05 Thread Ozgur Akgun
Great! That was pretty fast :)

Are you going to update invertible-syntax to use partial-isomorphisms-0.2?

2011/2/5 Tillmann Rendel tillm...@rendel.net

 Hi Ozgur,

 Ozgur Akgun wrote:

 I've already implemented a toy example and it worked great. Now I am
 trying
 to use your library in a more serious piece of code, and I've realised
 that
 defineIsomorphisms doesn't support record constructors. To be precise, you
 handle the case for NormalC in the code, however you do not handle RecC. I
 don't think this will be a difficult thing to add. Is there any reason for
 you not to support RecC?


 No reason at all. I just generalized the Template Haskell macros. They now
 support:

  * newtypes
  * infix constructors
  * record constructors

 Infix constructors are only support by constructorIso, though, not by
 defineIsomorphisms, because I can't think of a good automatic naming scheme.
 Suggestions welcome.

 The code is on hackage.

 There are still some constructors which are not supported: constructors of
 GADTs as well as data or newtype instances, and constructors with
 existentials. I would need to think about typing issues before supporting
 these.

  Tillmann




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


Re: [Haskell-cafe] Inheritance and Wrappers

2011-02-03 Thread Ozgur Akgun
On 3 February 2011 02:35, Brandon Moore brandon_m_mo...@yahoo.com wrote:

 Here's one thing to consider:

 Can you write a function

 f :: (Data a) = a - String
 f x = termTag x

 It would seem the Data a = Term a instance justifies
 this function, and it will always use the default instance.

 Now, what happens if f is applied to a value of some type
 T which is an instance of Data, but has a custom Term instance?


Great point, thanks!

I guess somehow you shouldn't be allowed to write that function f. I need
to think about this one.

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


Re: [Haskell-cafe] Haskell Functions

2011-02-03 Thread Ozgur Akgun
On 3 February 2011 18:33, Manolache Andrei-Ionut andressocrate...@yahoo.com
 wrote:

 first this is the curent code :http://pastebin.com/UPATJ0r


There is no code on that page. (It has expired, probably?)

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


Re: [Haskell-cafe] Reader monad wrapping State monad

2011-02-03 Thread Ozgur Akgun
On 3 February 2011 19:18, michael rice nowg...@yahoo.com wrote:

 but how do I get the constant a from the Reader monad?


http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Reader.html#v:ask

You also need to change the type to use ReaderT.

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


Re: [Haskell-cafe] Haskell Functions

2011-02-03 Thread Ozgur Akgun
(CCing haskell-cafe again)

Is this an homework question?

On 3 February 2011 20:30, Manolache Andrei-Ionut andressocrate...@yahoo.com
 wrote:

  http://pastebin.com/GxQBh3hx http://pastebin.com/GxQBh3hx

 --- On *Thu, 2/3/11, Ozgur Akgun ozgurak...@gmail.com* wrote:


 From: Ozgur Akgun ozgurak...@gmail.com
 Subject: Re: [Haskell-cafe] Haskell Functions
 To: Manolache Andrei-Ionut andressocrate...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Thursday, February 3, 2011, 10:59 AM


 On 3 February 2011 18:33, Manolache Andrei-Ionut 
 andressocrate...@yahoo.comhttp://mc/compose?to=andressocrate...@yahoo.com
  wrote:

 first this is the curent code :http://pastebin.com/UPATJ0r


 There is no code on that page. (It has expired, probably?)

 --
 Ozgur Akgun





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


Re: [Haskell-cafe] Inheritance and Wrappers

2011-02-01 Thread Ozgur Akgun
On 1 February 2011 11:41, John Lato jwl...@gmail.com wrote:

 The important point is that this declares an AbGroup instance for every
 type, not just types with Num instances.


So, is there a way to declare an AbGroup instance for the types with num
instances only?

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


Re: [Haskell-cafe] Inheritance and Wrappers

2011-02-01 Thread Ozgur Akgun
OK, what about this as a use case then. I want to create a type class 'Term'
with only one function in it. The function returns a 'termTag' which labels
the *kind* of a value in a DSL.

class Term a where
   termTag :: a - String

A user of this type-class can happily provide an instance without any other
type class requirement. However, I want those types which are instances of
Data to be an instance of Term automatically. On top of that, I don't want
to stop the user from creating a special instance for their data type.

I want to be able to write the following instance to accomplish that:

instance Data t = Term t where
termTag = show . toConstr

And if the user wants to write a more specific instance, they should be
welcome to do so:

instance Term UserDT where
termTag (...) = ...

I am not very much interested in the technical details about how things
currently are, I am more interested in a discussion about why (if?) this
would be considered a *design flaw*?

Best,

On 1 February 2011 12:18, Stephen Tetley stephen.tet...@gmail.com wrote:

 On 1 February 2011 11:47, Ozgur Akgun ozgurak...@gmail.com wrote:

 
  So, is there a way to declare an AbGroup instance for the types with num
  instances only?

 No - as Henning says its then no more useful than simply a function:

 add :: (Num u) = a - a - a
 add = (+)

 'Overarching instances' i.e. classes with one implementation are a
 design flaw, not a virtue [*] so this hypothetical extension isn't
 welcome...

 {-# LANGUAGE OverarchingInstances #-}


 [*] Of course, there might be some valid cases for things in Oleg
 Kiselyov's typecast style, but modelling numericals doesn't look like
 one of them.

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




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


[Haskell-cafe] combined parsing pretty-printing

2011-01-26 Thread Ozgur Akgun
Dear Café,

I working on a DSL represented by a algebraic data type with many
constructors. I can write (separately) a parser and a pretty-printer for it,
and I am doing so at the moment. However, this way it feels like repeating
the same information twice.

Is there any work to combine the two?

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


Re: [Haskell-cafe] Why is Haskell flagging this?

2010-12-22 Thread Ozgur Akgun
see also:
http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-State-Lazy.html#v:state

On 22 December 2010 20:02, Ryan Ingram ryani.s...@gmail.com wrote:

 Interesting.  In that case,

 state f = StateT $ \s - Identity (f s)

 allows state to replace State in that code.


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


Re: [Haskell-cafe] the beginning of the end

2010-12-05 Thread Ozgur Akgun
On 5 December 2010 20:22, Brandon S Allbery KF8NH allb...@ece.cmu.eduwrote:

 On 12/5/10 15:07 , Andrew Coppin wrote:
  you actually cannot do something as trivial as follow a conversation

 You can, just not via the web site.  I do it in Tweetdeck all the time.


You can also do it via the website, sort of.

If a tweet is a reply to another one, there is a in reply to link right
under the tweet. I guess other client applications (like tweetdeck) use this
link to create a conversation view.

I suppose, it is quite similar to what happens with e-mail.

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


[Haskell-cafe] Hackage down?

2010-12-04 Thread Ozgur Akgun
http://downforeveryoneorjustme.com/http://hackage.haskell.org

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


Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread Ozgur Akgun
This is a very generous offer. However, I must say I like the following idea
more:

http://www.reddit.com/r/haskell/comments/efw38/reminder_hackagehaskellorg_outage_tomorrow_due_to/c17u7nk

On 4 December 2010 16:31, Dan Knapp dan...@gmail.com wrote:

 With Hackage down, now seemed like a good time to push this issue
 again.  It's such an important site to us that it's really rather a
 shame there are no mirrors of it.  I have a personal-and-business
 server in a data center in Newark, with a fair chunk of bandwidth,
 which I'd like to offer for a permanent mirror.  Is there interest in
 this?  Who do I need to talk to for it to happen?

 Strategy-wise, I think the best approach is round-robin DNS, since
 that's transparent to the end user - everything would still appear at
 the URL it's at now, but behind-the-scenes magic would let things keep
 working when one or the other site is down.  I haven't personally set
 up such a system before but I'm willing to take on the burden of
 figuring it out.

 So I have a better idea of what I'm signing up for, can anyone tell me
 how much disk space and how much bandwidth per month Hackage uses?  I
 have a fair chunk of both, as I say, but I'd like to know in advance
 to ensure that things go smoothly.

 As for what I'd want in return for this, really nothing.  I wouldn't
 say no to an unobtrusive mention somewhere on the site, but I'd be
 happy just knowing I'd given something back to the Haskell community,
 which has given a lot to me.

 --
 Dan Knapp
 An infallible method of conciliating a tiger is to allow oneself to
 be devoured. (Konrad Adenauer)

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




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


Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-11 Thread Ozgur Akgun
On 11 November 2010 01:19, Richard O'Keefe o...@cs.otago.ac.nz wrote:

 I'm not sure that it is desirable to have many records in the
 same module in the first place.


Amongst other reasons,
http://www.haskell.org/haskellwiki/Mutually_recursive_modules

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


[Haskell-cafe] ghc dump the code for derived instances

2010-11-11 Thread Ozgur Akgun
Café,

Is there a way to make GHC dump the code for auto-derived type class
instances, say for Show, Eq and such?

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


Re: [Haskell-cafe] ghc dump the code for derived instances

2010-11-11 Thread Ozgur Akgun
Thanks!

On 11 November 2010 14:52, Daniel Fischer daniel.is.fisc...@web.de wrote:

 On Thursday 11 November 2010 15:27:09, Ozgur Akgun wrote:
  Café,
 
  Is there a way to make GHC dump the code for auto-derived type class
  instances, say for Show, Eq and such?

 -ddump-deriv

 
  Thanks,
  Ozgur




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


Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-10 Thread Ozgur Akgun
I still don't know whether I like this idea or not, but here is the simplest
definition I can think of about what it promises.

Using TDNR, it will be possible to write the following code:

data Foo = Foo { name :: String }
data Bar = Bar { name :: String }

getName :: Either Foo Bar - String
getName (Left  f) = name f
getName (Right b) = name b

However, currently you cannot: Multiple declarations of 'name'

There are basically two things you can do to solve this problem.
 - Use different names for your functions, a la fooName, barName. This
clutters up your code, and sometimes you may not have access to that part of
the code.
 - Define these 2 data types in different modules and import qualified, a la
Foo.name, Bar.name. One might still think this clutters up your code.

In any case, as a programmer you need to resolve which function to use
depending on types while defining 'getName'. However compiler has enough
information to automate this decision for you. This is not a way to do
polymorphism, this is merely a way to allow programmers define more than one
function with the same name, but different types.

This kinda sounds like what java people think polymorphism is :P

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


Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-10 Thread Ozgur Akgun
On 10 November 2010 10:56, Ozgur Akgun ozgurak...@gmail.com wrote:

 Using TDNR, it will be possible to write the following code:

 data Foo = Foo { name :: String }
 data Bar = Bar { name :: String }

 getName :: Either Foo Bar - String
 getName (Left  f) = name f
 getName (Right b) = name b

 However, currently you cannot: Multiple declarations of 'name'


Oh by the way, TDNR doesn't only work for record names, yet its use for
record names is an important motivation. This was just an example. I don't
want to cause any confusion while trying simplify things.

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


Re: [Haskell-Cafe] Parsing bytestream

2010-11-09 Thread Ozgur Akgun
If we change the code a bit,

data MyAction = A1 Word8 | A2 Word16

a,b :: Get MyAction

 a = A1 $ getWord8

 b = A2 $ getWord16be

listOfActions :: [Get MyAction]
listOfActions = [a,b,a]

Now, we know how to execute the list of actions, and get the output as list.
Using the following guys:

sequence :: Monad m = [m a] - m [a]
runGet :: Get a - ByteString - a

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


Re: [Haskell-cafe] Compiler constraints in cabal

2010-11-05 Thread Ozgur Akgun
AFAIK, the way to do this is putting constraints on the base package.

On 5 November 2010 14:59, Reiner Pope reiner.p...@gmail.com wrote:

 Hi,

 I have a library, hmatrix-static, on Hackage. Version 0.3 (the current
 version) compiles with ghc-6.12.

 Let's say I want to upgrade my library using new features in ghc-7.0,
 and then release these upgrades as version 0.4. Is there any way to
 state in my cabal file that this new version will no longer compile
 under ghc-6.12? The reason I would like to state this is so that a
 user with ghc-6.12 can do 'cabal install hmatrix-static' (or do a
 cabal install of a program depending on hmatrix-static) and see that
 cabal will install version 0.3 rather than attempt to install version
 0.4 and fail.

 Thanks for your help.

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




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


Re: [Haskell-cafe] Parsing workflow

2010-11-01 Thread Ozgur Akgun
On 1 November 2010 22:18, Andrew Coppin andrewcop...@btinternet.com wrote:

 I vaguely recall somebody mentioning a parser library on Hackage where
 try is the default behaviour and you turn it off explicitly, rather than
 turning it on explicitly. Apparently this is much more intuitive. But
 unfortunately I can't remember what the hell the library was...


polyparse, is it?

from http://code.haskell.org/~malcolm/polyparse/docs/index.html#what

 If you have only ever used the parsec combinators before, then you might be

pleasantly surprised by polyparse: all of the same functionality is
 available,

but it removes the confusion that all too commonly arises from a failure to

use parsec's try combinator correctly. Ambiguous grammars often fail to be

compositional in parsec, and it can be a black art guessing where to
 introduce

a try to fix it. In contrast, polyparsers are by default fully
 compositional.

It is possible to improve their efficiency (and the accuracy of error

messages) by inserting commits (which are the dual of try), but it is not

necessary for writing a correct parser, and furthermore, it is usually
 obvious

where it can be beneficial to add a commit.


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


Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Ozgur Akgun
I don't know if you've already used it, but Parsec includes some kind of a
lexer through the
Languagehttp://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Language.htmland
Tokenhttp://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Token.htmlmodules.
You can start by having a look at the
makeTokenParserhttp://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Token.html#v:makeTokenParser
 function.

On 31 October 2010 15:11, Nils Schweinsberg m...@n-sch.de wrote:

 Hi!

 I'm having a really hard time to write a correct parser for a small
 language I've developed. I have been trying to write a parser using parsec,
 but always get a lot of error messages like unexpected \n, expected ...,
 new-line or... when trying to run the parser. Then I read about the happy
 parser and really liked the separation of lexing the text into tokens and
 parsing the actual logic behind those tokens. Since I couldn't get familiar
 with the lexer alex I gave up on the alex-happy-approach again and went
 back to parsec. But with that lexer-parser idea on my mind, my parser
 currently looks a lot like a lexer. So I came up with the idea of using a
 combination of parsec and happy, where I generate a list of tokens for my
 text via parsec and analyse it with happy.


 My questions would be:

 - Is this a valid approach?

 - What is your workflow on parsing complex data structures?

 - What about performance? Since my project is going to be an interpreted
 language parsing performance might be interesting aswell. I've read that
 happy is in general faster than parsec, but what if I combine both of them
 as I said above? I guess that parsing a simple list of tokens without any
 nested parser structures would be pretty fast?

 - Do you have any other ideas on how to improve my parser?

 - What are your general thoughts on happy vs. parsec?


 Thanks for any replies,

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




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


Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Ozgur Akgun
On 31 October 2010 16:15, Nils Schweinsberg m...@n-sch.de wrote:

 This is exactly what gives me headaches. It's hard to tell where you need
 try/lookAhead and where you don't need them. And I don't really feel
 comfortable wrapping everything into try blocks...


I always thought this was an obvious decision: when combining 2 parsers `a`
 and `b` (i.e. a | b), if parser `a` fails without consuming any input do
not wrap it in a try, otherwise do.

Am I missing something?

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


[Haskell-cafe] Generic traversals for GADTs

2010-10-31 Thread Ozgur Akgun
Café,

SYB-style libraries (and especially Uniplate) make it very easy to run
generic
traversals (queries/transformations) on ADTs.

 data Expr = ...
 x :: Expr
 f :: Expr - Expr
 transform :: (Expr - Expr) - Expr - Expr
 transform f x :: Expr -- applies f to x (and its children) in a bottom-up
manner

Uniplate is very powerful and doesn't require any hand written type-class
instances to get going reasonably efficiently.

I can simply re-implement the functionality of Uniplate myself, modulo
requiring hand-written instances. (I didn't want to go into that road, since
I
don't need it for this argument.)

I did this exercise, because I wanted to understand why we don't have
similar
generic traversal libraries for GADTs. And, it didn't take long :)
I can post my trials but they are really baby steps and they wouldn't be
helpful.

My question is:

Considering how useful generic traversal libraries and GADTs are, has
anybody
tried implementing a generic traversal library (like Uniplate or similar)
for
GADTs? Is it a hard (or impossible, or not efficient, or problematic in some
other way) thing to implement, or is it just not a requirement for anyone
else?

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


Re: [Haskell-cafe] Decoupling type classes (e.g. Applicative)?

2010-10-29 Thread Ozgur Akgun
On 29 October 2010 14:35, Dominique Devriese 
dominique.devri...@cs.kuleuven.be wrote:

 I have a problem with the design of the Applicative type class


Sorry for going a bit off-topic, but every-time I see someone complaining
about such things, I remember this proposal:
http://repetae.net/recent/out/classalias.html

Just wanted to say, wouldn't it be nice? :)

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


Re: [Haskell-cafe] Finite but not fixed length...

2010-10-13 Thread Ozgur Akgun
Jonas,

2010/10/13 Jonas Almström Duregård jonas.dureg...@chalmers.se

 (++) :: Finite s1 a - Finite s2 a - Finite (S (Plus s1 s2)) a
 (++) (Finite a) (Finite b) = Finite $ a Prelude.++ b
 infixr 5 ++


Why do you have the S in the return type of Finite.++ ?

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


[Haskell-cafe] ghci - always show types

2010-10-13 Thread Ozgur Akgun
Cafe,

Just a quick question. Either I am hallucinating or there was a way of
saying ghci to always show types. It was working as if you typed :t it
after every line of input.

Sorry, I searched but couldn't find the option via google. Hope someone here
knows/remembers what I am talking about.

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


Re: [Haskell-cafe] ghci - always show types

2010-10-13 Thread Ozgur Akgun
On 13 October 2010 17:03, Christopher Done chrisd...@googlemail.com wrote:

  Options for ':set' and ':unset':

+rrevert top-level expressions after each evaluation
+sprint timing/memory stats after each evaluation
+tprint type after evaluation

 See :help to get this display.


Thanks!

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


Re: [Haskell-cafe] Re: Re-order type (flip map)

2010-10-10 Thread Ozgur Akgun
On 10 October 2010 22:32, Johannes Waldmann waldm...@imn.htwk-leipzig.dewrote:

 Oh, and while we're at it - are there standard notations
 for forward function composition and application?

 I mean instead of  h . g . f $ x
 I'd sometimes prefer   x ? f ? g ? h
 but what are the ?


While asking you use the same symbol for function composition, and something
like inverse function application. I don't think there exists an operator ?,
such that h . g . f $ x is equivalent to x ? f ? g ? h.

But you can simply define an inverse function application like the following
and have a close enough alternative,

($$) :: a - (a - b) - b
($$) = flip ($)
infixl 5 $$

Now the following two expression are identical, I suppose:

h . g . f $  x
x $$ f . g . h

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


Re: [Haskell-cafe] Re: Re-order type (flip map)

2010-10-10 Thread Ozgur Akgun
No, wrong. I am speaking nonsense here.

Of course one also needs to define a *forward* function composition operator
to get the effect you originally wanted.

My point was: you need to find/define two operators, not just one. That
still holds :)

Best,

On 10 October 2010 23:47, Ozgur Akgun ozgurak...@gmail.com wrote:


 On 10 October 2010 22:32, Johannes Waldmann 
 waldm...@imn.htwk-leipzig.dewrote:

 Oh, and while we're at it - are there standard notations
 for forward function composition and application?

 I mean instead of  h . g . f $ x
 I'd sometimes prefer   x ? f ? g ? h
 but what are the ?


 While asking you use the same symbol for function composition, and
 something like inverse function application. I don't think there exists an
 operator ?, such that h . g . f $ x is equivalent to x ? f ? g ? h.

 But you can simply define an inverse function application like the
 following and have a close enough alternative,

 ($$) :: a - (a - b) - b
 ($$) = flip ($)
 infixl 5 $$

 Now the following two expression are identical, I suppose:

 h . g . f $  x
 x $$ f . g . h

 Cheers,
 Ozgur




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


Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Ozgur Akgun
For what it's worth, after all this discussion my rather cheeky preference
is as follows:

Instead of introducing more specialised syntax, remove both existing special
syntaxes for if and case, and introduce multi-clause support for lambdas!

Cheers!

On 2 October 2010 19:23, Max Bolingbroke batterseapo...@hotmail.com wrote:

 Hi Cafe,

 I implemented the proposed Haskell' feature lambda-case/lambda-if [1]
 during the Haskell Implementors Workshop yesterday for a bit of fun.
 The patches are online [2, 3].

 The feature is demonstrated in this GHCi session:

 $ inplace/bin/ghc-stage2 --interactive -XLambdaCase
 GHCi, version 7.1.20101002: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Prelude (if then Haskell else Cafe) False
 Cafe
 Prelude (case of 1 - One; _ - Not-one) 1
 One
 Prelude :q

 Do you like this feature and think it would be worth incorporating
 this into GHC? Or is it too specialised to be of use? If there is
 enough support, I'll create a ticket and see what GHC HQ make of it.

 Max

 [1] http://hackage.haskell.org/trac/haskell-prime/ticket/41
 [2] http://www.omega-prime.co.uk/files/LambdaCase-Testsuite.patch
 [3] http://www.omega-prime.co.uk/files/LambdaCase-Compiler.patch
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




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


Re: [Haskell-cafe] Re: Haskell Helper

2010-10-04 Thread Ozgur Akgun
On 4 October 2010 23:10, c8h10n4o2 asaferibei...@ymail.com wrote:

 And why
 b - between (char ',') (char '=') (sepBy alphaNum (char ',') )
 does not return [String] ?


alphaNum :: Parser Char
sepBy :: Parser a - Parser sep - Parser [a]
sepBy alphaNum sepP :: Parser [Char] or Parser String but not Parser
[String]
between :: Parser open - Parser close - Parser a - Parser a
between openP closeP (sepBy alphaNum sepP) :: Parser String

Hope this helps,
Ozgur
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell Helper

2010-10-04 Thread Ozgur Akgun
On 4 October 2010 23:54, c8h10n4o2 asaferibei...@ymail.com wrote:

 By the way, there is a parser that returns [String] for my case?


If you are trying to parse strings (of alphaNum's) separated by commas, you
can use many alphaNum (or many1 alphaNum depending on what you want)
instead of simply using alphaNum. The type of the complete parser will then
be Parser [String].

alphaNum :: Parser Char

alphaNums :: Parser String
alphaNums = many alphaNum

alphaNums1 :: Parser String
alphaNums1 = many1 alphaNum

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


Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Ozgur Akgun
On 2 October 2010 19:33, Henning Thielemann
lemm...@henning-thielemann.dewrote:


 On Sat, 2 Oct 2010, Max Bolingbroke wrote:

 ... lambda-case/lambda-if ...


 Nice! Concerning if-then-else I would more like to see an according
 function to go to Data.Bool, then we won't need more syntactic sugar like
 if-then-else. However the lambda-case would be useful for me.


And I was just reading this entry in the wiki:
http://www.haskell.org/haskellwiki/If-then-else

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


Re: [Haskell-cafe] Inverse of HaskellDB

2010-09-29 Thread Ozgur Akgun
OK, I am rephrasing it a bit then :)
I definitely don't think this would be trivial to implement. However, I'd
expect a decent solution to this problem, not to have special combinators to
describe relations between data types, but let the user model their data
using plain haskell data types, and infer the associated table structure
just by looking at the data types.

I'll give this a harder thought once I find the time. There is the huge
barrier of TH, stopping me from playing with things like this.

Anyway, have fun! :)

On 29 September 2010 10:41, Chris Eidhof ch...@eidhof.nl wrote:

 On 28 sep 2010, at 17:33, Ozgur Akgun wrote:

  How do you define relationships between data types?
 
  Well, why is it any different from other fields? From one of your
 examples [1], I'd expect you to have a list of questions in the Quiz data
 type, and if necessary, a quiz field in the Question data type. This might
 be a bit tricky but certainly achievable [2].

 This is really tricky. For example, consider storing a large tree in the
 database:

  data Tree = Node Int Tree Tree | Leaf Int

 This means you need to read the entire tree from the database. Or consider
 cyclic datastructures (such as the example you gave). How do you store this?
 The only way to inspect this is using a library like data-reify [1].

 I think the problem might be a bit harder than you suspect.

 Another way to solve it is using Sebastiaan Visser's framework, described
 in his paper [2], but that's also rather complicated.

 -chris

 [1]: http://hackage.haskell.org/package/data-reify
 [2]:
 http://github.com/downloads/sebastiaanvisser/msc-thesis/wgp10-genstorage.pdf




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


Re: [Haskell-cafe] Inverse of HaskellDB

2010-09-28 Thread Ozgur Akgun

 How do you define relationships between data types?


Well, why is it any different from other fields? From one of your examples
[1], I'd expect you to have a list of questions in the Quiz data type, and
if necessary, a quiz field in the Question data type. This might be a bit
tricky but certainly achievable [2].

Something like the following:

data Quiz = Quiz {
  description :: String,
  subject :: String,
  questions   :: [Question]
} deriving (Show, Read)

data Question = Question {
  title   :: String,
  choiceA :: String,
  choiceB :: String,
  choiceC :: String,
  quiz:: Quiz
} deriving (Show, Read)


[1] http://github.com/chriseidhof/persist/blob/master/examples/Model.phs
[2] http://www.haskell.org/haskellwiki/Tying_the_Knot

On 28 September 2010 16:13, Chris Eidhof ch...@eidhof.nl wrote:

 Hey Jonathan,

 I've done some work on this. The hard part is defining relationships
 between datatypes: how do you model this in Haskell? I've some code on
 github: http://github.com/chriseidhof/persist, you might be interested in
 that.

 -chris

 On 25 sep 2010, at 21:31, Jonathan Geddes wrote:

  Cafe,
 
  HaskellDB takes a database schema and produces Haskell data structures
  (plus some other query-related stuff for its EDSL query language).
 
  What I'm looking for is the inverse of this functionality. I want to
  create tables based on a Haskell data structure with a few simple
  rules. These rules include: if a field is not of the form `Maybe a'
  then it can't be nullable in the database. If a field is not a
  primitive (in the database) then it is actually stored in another
  table and a reference id is stored in the table. Tables are produced
  recursively, unless they already exist, etc.
 
  The HaskellDB approach is great for interfacing with existing tables,
  but in my case I already have data structures and now I would like a
  quick way to create tables to persist them.
 
  Does such a thing exist? If not, would you find it useful? I may take
  this up as a side project if it does not already exist and others
  would find it useful.
 
  Thanks,
 
  --Jonathan
  ___
  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




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


Re: [Haskell-cafe] searching haskell-cafe ?

2010-09-19 Thread Ozgur Akgun
if you want to use google, here[1], it suggests using the 'list:' keyword to
search in a mailing list archives.
eg. http://www.google.co.uk/#hl=enq=fundep+list%3Ahaskell-cafe.haskell.org

hope this helps,

[1] http://mail.google.com/support/bin/answer.py?hl=enanswer=7190

On 20 September 2010 00:01, bri...@aracnet.com wrote:

 is there a way to search the haskell-cafe list.

 I found a potential link on the haskell wiki, but the link is busted.

 Didn't see anything on the haskell-cafe mailing list page.

 Thanks,

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




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


Re: [Haskell-cafe] ghc in macports

2010-08-12 Thread Ozgur Akgun
sounds good to me. where can I find the list of packages (or whatever they
call them in homebrew, formula?) available?

On 12 August 2010 11:49, Benedict Eastaugh ionf...@gmail.com wrote:

 On 11 August 2010 15:49, Ozgur Akgun ozgurak...@gmail.com wrote:

  Personally, I'd like to use the macports version, if the ghc version
 there
  was resonably recent (having 2 versions, a stable and an edge could be a
  good idea?)

 You could use Homebrew instead. That has a fairly up-to-date version
 of GHC and the Haskell Platform.

 http://mxcl.github.com/homebrew/




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


Re: [Haskell-cafe] ghc in macports

2010-08-12 Thread Ozgur Akgun
On 12 August 2010 12:52, Hans Aberg haber...@telia.com wrote:

 On
  http://wiki.github.com/mxcl/homebrew/installation
 it says:
  delete /usr/local/include and/usr/local/lib
 So its not for those that also installs standard distributions, it seems.


I thought this was just a recommendation.

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


[Haskell-cafe] ghc in macports

2010-08-11 Thread Ozgur Akgun
Dear Cafe,

I wonder who is maintaining the ghc package in macports, and what the
current stategy of doing things is?
http://www.macports.org/ports.php?by=namesubstr=ghc (ghc 6.10.4)

Personally, I'd like to use the macports version, if the ghc version there
was resonably recent (having 2 versions, a stable and an edge could be a
good idea?)

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


Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-04 Thread Ozgur Akgun
A few points,

* The text in Synopsis part is typically wide. (See
http://www.ozonehouse.com/mark/snap-xhtml/heist/Text-Templating-Heist.htmlwith
Ocean style)
I think it would be more *usable *if it was at the bottom of the page (again
with a similar button and open/close toggling effect)

* On my browser (firefox on a mac) if I select any of the two styles other
than Ocean, module pages seem like they do not apply any style. And also
they still reference ocean.css. A cookie problem or something like that?

* Opening the synopsis frame (either at its current position or at the
bottom of the page) might be better if it was implemented as a preference.
Namely, if I open the synopsis frame in a module page, I'd possibly like to
see it in the next modules page as well. Carrying that information to the
same extend as preferred style information sounds like a better idea to me.

Thanks for the work!

Best,

On 4 August 2010 06:00, Mark Lentczner ma...@glyphic.com wrote:

 The Haddock team has spent the last few months revamping the look of the
 generated output. We're pretty close to done, but we'd like to get the
 community's input before we put it in the main release.

 Please take a look, and then give us your feedback through a short survey

 Sample pages:  http://www.ozonehouse.com/mark/snap-xhtml/index.html
 Frame version: http://www.ozonehouse.com/mark/snap-xhtml/frames.html

 Survey:

 http://spreadsheets.google.com/viewform?formkey=dHcwYzdMNkl5WER1aVBXdV9HX1l5U3c6MQ
 Short link to same survey:
http://bit.ly/9Zvs9B

 Thanks!

- Mark

 Mark Lentczner
 http://www.ozonehouse.com/mark/
 irc: MtnViewMark



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




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


Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-03 Thread Ozgur Akgun
Today I read this fantastic blog post:
You Could Have Invented Monads! (And Maybe You Already Have.)
http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html

You most probably have seen the post by now, but I just wanted to remind it,
just in case.

Best,

On 3 August 2010 22:51, aditya siram aditya.si...@gmail.com wrote:

 Hi all,
 I am doing an Intro To Monads talk in September [1]. The audience
 consists of experienced non-Haskell developers but they will be familiar
 with basic functional concepts (closures, first-class functions etc.).

 I am looking for suggestions on how to introduce the concept and its
 implications. I'd also like to include a section on why monads exist and why
 we don't really see them outside of Haskell.

 Has anyone here done a talk like this? And if so what parts of your
 presentation were successful and what would you stay away from.

 Thanks for the feedback.
 -deech

 [1] It's in St.Louis, Missouri at the St.Louis Perl Mongers 
 meetinghttp://St.Louis%20Perl%20Mongers%20meetingso come on by if you're 
 around!

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




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


Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-26 Thread Ozgur Akgun
I think it is pretty cool as well. But I think there is a problem with
viewing it as a wildcard.

let's say we define the following:

(??) = flip

foo :: a - b - c
foo ?? x :: a - c

Perfect!

But saying ?? can be used as a wildcard might in the following wrong
perception:

foo x ?? :: b - c -- WRONG

Just a small concern. Other than that, very neat!

On 26 July 2010 21:42, Nils m...@n-sch.de wrote:

 On 26.07.2010 08:33, David Virebayre wrote:

 listeEtagTot = concatMap (`listeEtagArm` cfgTypesTringle) listeArmOrd


 You can use flip as a wildcard aswell:

  listeEtagTot = concatMap (listeEtagArm `flip` cfgTypesTringle)
 listeArmOrd

 Makes it even more readable in my opinion, since this really shows you
 where the value belongs to.

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




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


Re: [Haskell-cafe] Random this! ;-)

2010-07-25 Thread Ozgur Akgun
Sorry but I'll just go ahead and eta reduce it :)

rollNDiceIO = flip replicateM $ randomRIO (1,6)

On 25 July 2010 16:44, Max Rabkin max.rab...@gmail.com wrote:

 On Sun, Jul 25, 2010 at 5:39 PM, michael rice nowg...@yahoo.com wrote:
 
  I know, ugly, but at least I got it to work. What's a better way to
 generate this list?

 rollNDiceIO n
   = sequence . replicate n $ randomRIO (1,6)
 {{ sequence . replicate n = replicateM n }}
   = replicateM n $ randomRIO (1, 6)

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




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


Re: [Haskell-cafe] Re: GATD and pattern matching

2010-06-11 Thread Ozgur Akgun
I don't know whether its a good name or not (the ===), but I have the
following in a generic utilities file I have, and I use it every now and
then.

(===) :: (Typeable a, Typeable b, Eq b) = a - b - Bool
(===) x y = cast x == Just y

(Notice you don't need Eq a in the context)

On 11 June 2010 12:51, Ben Millwood hask...@benmachine.co.uk wrote:

 On Fri, Jun 11, 2010 at 12:46 AM, Felipe Lessa felipe.le...@gmail.com
 wrote:
 
   eqTypeable :: (Typeable a, Eq a, Typeable b, Eq b) = a - b - Bool
   eqTypeable x y = case cast y of
  Just y' - x == y'
  Nothing - False
 

 ...or indeed:

 eqTypeable x y = cast x == Just y
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




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


  1   2   >