(from thread:
http://www.haskell.org/pipermail/beginners/2013-October/012703.html)
Why type inference can't resolve this code?
{-# LANGUAGE RankNTypes, ConstraintKinds #-}
bar :: (Num a, Num b) = (forall c. Num c = c - c) - Either a b -
Either a b
bar f (Left a) = Left (f a)
bar f (Right b)
Everybody is claiming that using lift is a bad thing.
So, I come to remedy this problem.
Stop lifting, start using shinny operators like this one:
(^$) :: Monad m = m a - (a - b - c) - m b - m c
(^$) = flip liftM2
Then you can do wonderful stuff and you will never read the four-letter
I've just read Semantic Versioning (SemVer) [1], Package Versioning Policy
(PVP) [2] and Eternal Compatibility in Theory (ECT) [3].
Is PVP the one that every package on Hackage should use?
SemVer seems to make more sense to me.
Also, ECT looks very promising, but it is dated back to 2005 and I
Gherkin is the language that Cucumber understands. It is a Business
Readable, Domain Specific Language that lets you describe software’s
behaviour without detailing how that behaviour is implemented. [1]
The example detailed how foldl is implemented.
Also, as it is intended to be a DSL for
I hope these jokes do not cause people to be afraid to post new ideas.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
The package GLFW is not building in Cabal 1.18.
Setup.hs [1] depends on `rawSystemStdInOut` [2] that changed signature
between 1.16 and 1.18.
Is this considered a public API of Cabal?
Cabal 1.16
rawSystemStdInOut
:: Verbosity
- FilePath
- [String]
- Maybe (String, Bool)
- Bool
- IO
I can't install tasty with cabal. Anyone with the same issue or a fix?
$ cabal install tasty
...
Test\Tasty\Core.hs:147:11: Not in scope: `witness'
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
I've just read the post Destroying Performance with Strictness by Neil
Mitchell [1].
One of the comments from an Anonymous says:
How hard would it be to lift strictness annotations to type-level? E.g.
instead of
f :: Int - Int
f !x = x + 1
write
f :: !Int - Int
f x = x + 1
which would have the
-cafe-2...@jaguarpaw.co.uk
On Thu, Aug 22, 2013 at 12:51:24PM -0300, Thiago Negri wrote:
How hard would it be to lift strictness annotations to type-level? E.g.
instead of
f :: Int - Int
f !x = x + 1
write
f :: !Int - Int
f x = x + 1
which would have the same effect. At least
I just stumbled upon the Applicative term.
Arrows are quite difficult for me to understand at the moment.
I guess it needs time to digest.
But, as I understand so far, Applicative and Arrows looks like the same
thing.
Please, enlight me.
___
Mathijs Kwik math...@bluescreen303.nl
Thiago Negri evoh...@gmail.com writes:
I just stumbled upon the Applicative term.
Arrows are quite difficult for me to understand at the moment.
I guess it needs time to digest.
But, as I understand so far, Applicative and Arrows looks like the same
+ you may be interested in the
resourcet package [1] (which is used by conduit to handle resources).
Cheers,
[1] http://hackage.haskell.org/package/resourcet
On Tue, Jan 29, 2013 at 8:59 PM, Thiago Negri evoh...@gmail.com wrote:
`Control.Exception.bracket` is a nice function to acquire
`Control.Exception.bracket` is a nice function to acquire and release a
resource in a small context.
But, how should I handle resources that are hold for a long time?
Should I put `Control.Exception.finally` on every single line of my
finalizers?
What exceptions may occur on an IO operation?
Do you need advice on what? I didn't understand your last phrase.
Em 26/01/2013 06:25, Erik de Castro Lopo mle...@mega-nerd.com escreveu:
Hi all,
I am in the process of writing a Haskell program consisting of two
threads, one for performing a calculation and one for an Ncurses UI
I'm trying SDL on Windows, and things are getting really weird.
I can compile the code (links on the end).
When I run it, if I try using `stdin` the program crashes with this
message:
stdin: hGetLine: invalid argument (Bad file descriptor)
Is it something to do with SDL itself?
What am I doing
On Sat, 26 Jan 2013 21:52:03 +0100, Brandon Allbery allber...@gmail.com
wrote:
On Sat, Jan 26, 2013 at 3:34 PM, Thiago Negri evoh...@gmail.com wrote:
I'm trying SDL on Windows, and things are getting really weird.
I can compile the code (links on the end).
When I run it, if I try using
Is it possible to play the generated chords as a melody by itself, without
the original music over it?
2013/1/18 Alfredo Di Napoli alfredo.dinap...@gmail.com
Congratulations!
Keep up the good work, especially in using Haskell at a commercial level :)
Bye!
Alfredo
On 18 January 2013
Hello.
How do I achieve type hierarchy in Haskell?
Suppose we have the following code:
foo :: A - C
bar :: B - C
I want something that allow me to say that B is a subtype of A, meaning:
1. I can use a value of type A where a value of type A is needed.
2. I can use a value of type B where a
:: a - A
foo' :: IsA a = a - C
foo' = foo . toA
However, you may asking the wrong question since it smells like you're
trying to embed OO into Haskell =).
Cheers,
On Wed, Jan 16, 2013 at 1:03 PM, Thiago Negri evoh...@gmail.com wrote:
Hello.
How do I achieve type hierarchy in Haskell
I'm trying to handle my usb controller (xbox model) via GLFW.
I can get it's input, but I see a strange behaviour in my sample
application that I couldn't explain.
Can you enlight me please?
If I disable automatic event polling on buffer swapping (line A), the
screen content is refreshed but OS
Can you please show some examples where it might be useful?
I miss the point.
Thanks,
Thiago.
2012/10/26 John Wiegley jo...@newartisans.com:
Greg Fitzgerald gari...@gmail.com writes:
I've recently found myself using the expression: foldr (.) id to compose a
list (or Foldable) of functions.
+1
2012/10/18 niket niketku...@gmail.com:
I would love to see Haskell growing on such new platforms!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
I'm trying OpenGL on Haskell and couldn't create the FreeGLUT DLL myself.
I did follow this tutorial:
http://netsuperbrain.com/blog/posts/freeglut-windows-hopengl-hglut/
But when I put my DLL on the folder of the binary, it complains about
initGlut.
Using the DLL pointed by FreeGLUT official
Is it possible to capture more than one constructor in a single
pattern matching?
I mean, is it possible to generalize the following pattern matching of
A and B to a single branch?
g f C = [f C]
g f v@(A _ n) = f v : g n
g f v@(B _ n) = f v : g n
For example:
g f C = [f C]
g f v@(A|B _ n) = f v
I'm following Yesod tutorial that gives this as the first example for
type-safe URLs:
| getHomeR = defaultLayout [whamlet|a href=@{Page1R}Go to page 1!|]
Worked fine, the a href generated looks perfect.
Then I tried this:
| getHomeR = defaultLayout [whamlet|Hello!a href=@{Page1R}Go to page
Is it possible to compile Haskell code targetting a OS/arch that
differs from the one where the compiler (GHC) is running?
Thanks.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hello everyone.
I just posted about a fact that happens to everyone who codes in Java
while learning Haskell.
You end up trading knowledge from both sides.
I'll appreciate if you could read and send me feedbacks:
http://me-hunz.blogspot.com.br/2012/08/bringing-knowledge-from-haskell-to-java.html
| I have pasted a version of your code that uses Template Haskell at
| http://hpaste.org/73520. Where did you get stuck?
Your version worked like a charm. I'm quite new to Haskell, so I was
trying desperately to get TH working: forgot to quote worker at
mkClosure.
| 1. A bug in the
Hello everyone. I'm taking my first steps in Cloud Haskell and got
some unexpected behaviors.
I used the code from Raspberry Pi in a Haskell Cloud [1] as a first
example. Did try to switch the code to use Template Haskell with no
luck, stick with the verbose style.
I changed some of the code,
I'm new to Haskell, but I do like your idea.
I prefer this as a built-in feature because it will create a standard
way of doing this, making the question wich package should I use to
get mutatos? lens-foo, lens-bar, monad-lens, lens-lens-foo-bar, ...?
simply go away.
So, yes, I up-vote your idea
with a way to implement this?
-- ryan
On Sat, Jul 28, 2012 at 10:07 AM, Steffen Schuldenzucker
sschuldenzuc...@uni-bonn.de wrote:
On 07/28/2012 03:35 PM, Thiago Negri wrote:
[...]
As Monads are used for sequencing, first thing I did was to define the
following data type:
data TableDefinition
Hello.
I'm trying to understand Monads. In order to do so, I decided to
create my own Monad for a simple domain-specific language.
The idea is to define a way to describe a multi-value replacement
inside do-notation.
Example of a function doing what I want (without Monads):
replaceAll :: (a -
I'm solving this exercise:
http://www.haskell.org/haskellwiki/All_About_Monads#Exercise_4:_Using_the_Monad_class_constraint
I'm missing a function to transform a Maybe a into a MonadPlus m = m a.
I did search on Hoogle with no luck.
There is no standard definition for the g function I'm
Hi all.
I wrote a very simple program to try out parallel Haskel and check how
it would look like to make use of more than one core in this language.
When I tried the program with RTS option -N1, total time shows it took
2.48 seconds to complete and around 65% of that time was taken by GC.
Then
lists like this is a common source of problems. In
particular, nested loops can make it even trickier to prevent sharing as
there may not be an opportunity for parallel evaluation.
Anthony
On Mar 10, 2012, at 10:21 AM, Thiago Negri evoh...@gmail.com wrote:
Hi all.
I wrote a very simple
I will enjoy listening to a podcast like that.
The community can provide interesting content (links, posts, papers, ...).
Sort of a central feed to submit your suggestion to be discussed in
subsequent podcasts.
Thiago.
2012/2/22 Christopher Done chrisd...@googlemail.com:
With permission I
There is also Hoogle, pretty equivalent I guess.
http://www.haskell.org/hoogle/
Thiago.
2012/1/21 Christoph Breitkopf chbreitk...@googlemail.com:
One thing I found useful when looking if a function already exists under a
different name is to use Hayoo to search for the type, i.e.:
Do not compile:
f :: a - a
f x = x :: a
Couldn't match type `a' with `a1'
`a' is a rigid type variable bound by
the type signature for f :: a - a at C:\teste.hs:4:1
`a1' is a rigid type variable bound by
an expression type signature: a1 at C:\teste.hs:4:7
means that you have no
information about it's real type.
Thiago.
2012/1/4 Antoine Latter aslat...@gmail.com:
On Wed, Jan 4, 2012 at 9:08 AM, Thiago Negri evoh...@gmail.com wrote:
Do not compile:
f :: a - a
f x = x :: a
Couldn't match type `a' with `a1'
`a' is a rigid type variable
I got a glimpse of understanding of what you are talking about after
reading the wiki [1].
Still difficult to reason about the difference between lazy and
non-strict without taking a look at the text.
I hope somebody will make an effort to better explain the differences
and persist it in the
[5] http://en.wikipedia.org/wiki/Evaluation_strategy
2011/12/28 Thiago Negri evoh...@gmail.com:
I got a glimpse of understanding of what you are talking about after
reading the wiki [1].
Still difficult to reason about the difference between lazy and
non-strict without taking a look
2011/12/28 Jon Fairbairn jon.fairba...@cl.cam.ac.uk:
* non-strict semantics require that no argument is evaluated
unless needed.
That's not the case on optimistic evaluation.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
We can do functional programming on Java. We use all the design patterns
for that.
At the very end, everything is just some noisy, hairy, side-effectfull,
gotofull machinery code.
The beauty of Haskell is that it allows you to limit the things you need to
reason about. If I see a function with
How would you represent it then?
Would it cause a compiler error?
Thiago.
2011/12/20 Ben Lippmeier b...@ouroborus.net:
On 20/12/2011, at 6:06 PM, Roman Cheplyaka wrote:
* Alexander Solla alex.so...@gmail.com [2011-12-19 19:10:32-0800]
* Documentation that discourages thinking about bottom
What I think to be the hard part to do is to put this on the type system, e.g.:
intDiv x y = if y x then 0 else 1 + (intDiv (x - y) y)
Should not compile. Otherwise you will need the bottom value.
Am I missing something?
Thiago.
2011/12/20 Jesse Schalken jesseschal...@gmail.com:
On Tue,
words' = BS.words
makeString' = BS.pack
-- code end
Thanks all,
Thiago.
2011/8/11 Henning Thielemann schlepp...@henning-thielemann.de:
On 09.08.2011 01:43, Thiago Negri wrote:
Hello all,
I'm relatively new to Haskell and trying to solve some online judge's
problems in it.
One of the problems
Hello all,
I'm relatively new to Haskell and trying to solve some online judge's
problems in it.
One of the problems is to say if a given sentence is a tautogram or not.
A tautogram is just a sentence with all the words starting with the same letter.
My first try (solution is ok) was to do it as
Hello all,
I'm a newbie at Haskell and I was not aware of this problem.
So, equality comparison can run into an infinite-loop?
My current knowledge of the language tells me that everything is
Haskell is a thunk until it's value is really needed.
Is it possible to implement (==) that first check
48 matches
Mail list logo