Re: [Haskell-cafe] Hackage checking maintainership of packages

2013-05-07 Thread Ilya Portnov

Hi Cafe.



I have thought that a more interesting metric might be to send the
maintainer an email when their package stops building automatically 
on

hackage.


I think, this is must have feature for new hackage. If error was 
occured during build, send email to maintainer: Error occured while 
building your package name with GHC version. Build log:  If 
you are to fix it in a week [month?], please send reply for this 
message. If answer was received, then do not send such notifications 
every time during specified period (say, a week or month). If after end 
of this period, package still could not be build, then send next 
notification, maybe with additional question: If you are to maintain 
this package, please send a reply for this message...


With any scenario, build failed notifications is a must have 
feature.


WBR, Ilya Portnov.

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


Re: [Haskell-cafe] Hackage checking maintainership of packages

2013-05-07 Thread Ilya Portnov

07.05.2013 14:21, Ivan Lazar Miljenovic пишет:

On 7 May 2013 17:36, Ilya Portnovport...@iportnov.ru  wrote:

Hi Cafe.




I have thought that a more interesting metric might be to send the
maintainer an email when their package stops building automatically on
hackage.



I think, this is must have feature for new hackage. If error was occured
during build, send email to maintainer:


Except that there are various reasons a package won't build on Hackage:

* Temporary glitch with another Haskell dependency (e.g. package Foo
depends upon Bar-x.*; maintainer of Bar uploads a new point release of
Bar that fails to build just before Foo's maintainer uploads the new
version, thus the build server picks the buggy version of Bar and thus
the new version of Foo fails to build).

* Requires a foreign library that isn't installed on the Hackage build server.

* OS-dependent.



Anyway, if package does not build, only maintainer can know why and what 
to do with it. As for OS- and environment-dependent packages, it would 
be nice to let maintainer mark package as not buildable, so that 
hackage should not try to build it.


WBR, Ilya Portnov.

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


Re: [Haskell-cafe] Display an inferred type during compilation

2013-04-27 Thread Ilya Portnov
В письме от 27 апреля 2013 18:55:16 пользователь Corentin Dupont написал:


Hi Cafe,can I ask the compiler to display the type of an inferred value during 
compile 
time?It would be great if I can output a string during compilation with the 
type.A little 
bit like running :type in GHCi, but without GHCi... Because running GHCi is 
sometime 
painful (I have to clean my code first).

I'm thinking of something like:

main :: IO ()main = do   a - someCode   displayTypeAtCompileTime a   return ()

$ ghc -c test.hstest.hs:4:3: your type is: Foo

Thanks,Corentin


Hi.

What about TemplateHaskell? Smth like:

{-# LANGUAGE TemplateHaskell #-}
module DisplayType where

import Language.TH

displayTypeAtCompileTime :: Name - Q Exp
displayTypeAtComileTime name = do
reified - reify name
  -- inspect reified structure, see TH haddock documentation
runIO $ putStrLn $ show theType
 [| undefined |] -- you need to return some expression; since you are not 
to use it's 
value, it may be even undefined, it seems.

###

{-# LANGUAGE TemplateHaskell #-}
module Main where


import DisplayType

main = do
...
$displayTypeAtCompileTime 'a
...



WBR, Ilya Portnov.


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


Re: [Haskell-cafe] monoid pair of monoids?

2012-12-21 Thread Ilya Portnov

Hi.

Christopher Howard писал 21.12.2012 14:27:



instance (Monoid a, Monoid b, Monoid c, Monoid d) = Monoid (Socket4 
a b

c d) where
mempty = Socket4 mempty mempty mempty mempty
Socket4 a b c d `mappend` Socket4 w x y z =
Socket4 (a `mappend` w) (b `mappend` x) (c `mappend` y) (d
`mappend` z)

data Socket 5 a b c d e... et cetera


Seeing as the pattern here is so rigid and obvious, I was wondering: 
is
it possible to abstract this even more? So I could, for instance, 
just
specify that I want a Socket with 8 types, and poof, it would be 
there?

Or is this as meta as we get? (I.e., without going to something like
Template Haskell.)


Something like

data a ::: b = a ::: b

infixl 5 :::

instance (Monoid a, Monoid b) = Monoid (a ::: b) where ...

So, Monoid instance for, say, (a ::: b ::: c) == ((a ::: b) ::: c) will 
(should) be inferred automatically.


WBR, Ilya Portnov

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


Re: [Haskell-cafe] Instead of Haskell running on the JVM is there a way for Haskell to call a JVM language ...

2012-11-20 Thread Ilya Portnov

Hi all.

JP Moresmau писал 20.11.2012 13:01:

You may want to have a look at my little HJVM project on Github (
https://github.com/JPMoresmau/HJVM). Promise, I'll put in on Hackage 
some
day. Basically it provides FFI wrappers and some c code to be able to 
start

a JVM and call Java methods, etc from Haskell.


Please take a look at http://hackage.haskell.org/package/hs-java also. 
It's an assembler/disassembler of Java bytecode and *.class files. 
Moreover, there is https://github.com/MateVM/MateVM — an (experimental) 
Java VM on Haskell :) So, if you are interested in haskell/java interop, 
maybe we could integrate our efforts.


Best regards,
Ilya Portnov.



--
JP Moresmau
http://jpmoresmau.blogspot.com/

On Tue, Nov 20, 2012 at 7:53 AM, Mathijs Kwik
math...@bluescreen303.nlwrote:


KC kc1...@gmail.com writes:

 Instead of Haskell running on the JVM is there a way for Haskell 
to
 call a JVM language (or generate bytecode) to access the Java 
class

 libraries when needed?

I once did a small test to get this working.
It's not that hard, but needs some work. It's fine for exposing a 
few

functions though.

Basically it's a 2-step process, eased by using a makefile or 
similar

helper.

You have to compile your haskell code into a shared object (.so on
linux, .dll on windows), which includes the haskell runtime (rts).

This library can be called from c.
A small pitfall is that you first need to do a call to initialize 
the

haskell runtime, and when you're done using it, close it.
This is most easily just tied to your c/java program's main
initialization functions.

Java is able to load/use these shared libraries through JNI.
Of course you lose your platform-independance, so if you want your 
java

application to work on multiple platforms / OSses, you need to build
shared objects for all of them.

Last but not least:
You have to export the haskell functions you want through FFI.
Also, make sure they use raw data types such as CString, as that 
what C

and java will give you and expect back.

So basically you go Haskell FFI - C - Java JNI

I'm sorry I cannot give you any links or code, because I'm in a bit 
of a

hurry. But google and the ghc docs are your friend.

Mathijs




 Or

 Is there a way for a JVM language or bytecode to call Haskell when
needed?

___
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


[Haskell-cafe] Typed TemplateHaskell?

2012-05-23 Thread Ilya Portnov

Hello Haskell world.

One well-known missfeature of TemplateHaskell is it's «untypedness». I 
mean, that if you have say an expression (Exp or Q Exp), you do not know 
it's type (does it represent String or Int or whatever). And GHC does 
not know too. So, one could easily construct bad-typed expressions using 
TH, and GHC will complain only on generated code, not on TH code.


Such a missfeature was a reasoned decision, because adding some typing 
into TH will add much complexity to compiler and to language.


As far as can I see, using features of last GHC one could write typed 
TH library relatively easily, and saving backwards compatibility.


For example, now we have Q monad and Exp type in template-haskell 
package. Let's imagine some new package, say typed-template-haskell, 
with new TQ monad and new polymorphic type Exp :: * - *. Using last 
GHC's features, one will easily write something like expr :: Exp 
String, which will mean that expr represents a string expression. And 
we will need a new function, say runTQ :: TQ a - Q a (or some more 
complicated type), which will turn TypedTemplateHaskell's constructs 
into plain TH.


One question will be on quotations and antiquotations: they are 
implemented to work untyped TH constructs, how to implement 
compatibility with new typed TH? We could add some support of them to 
GHC... Or, maybe define a phantom type (say, Any), and some conversion 
functions, say untyped :: Language.Haskell.TH.Syntax.Exp - 
Language.Haskell.TH.Typed.Syntax.Exp Any.


Main idea is: seems new GHC enables us to implement typed TH without 
modifying GHC itself, only by writing a library. Is it so?


Any further thoughts?

With best regards,
Ilya Portnov.

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


[Haskell-cafe] Named captures in regex-pcre?

2012-01-28 Thread Ilya Portnov

Hi haskell-cafe.

Is there a way to get named captures from regex using regex-pcre (or 
maybe other PCRE-package)? For example, I want to write something like


let result = ab 12 cd =~ ab (?Pnumber\d+) cd :: SomeCrypticType

and then have namedCaptures result == [(number, 12)].

I do not see somewhat similar in regex-pcre documentation. It parses 
such regexs fine, and captures work, but i do not see way to get _named_ 
captures.


WBR, Ilya Portnov.

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


Re: [Haskell-cafe] bindings for libvirt

2012-01-24 Thread Ilya Portnov

24.01.2012 10:50, Michael Litchard writes:

Ilya,
   Yes please. Examining your code would go a long way toward
helping me with this project.


Ok, I published my current code at gitorious: 
https://gitorious.org/libvirt-hs. Please feel free to contribute, or 
even use (it's quite uncomplete currently) :) Bug reports, suggestions 
and patches are also welcome.


WBR, Ilya Portnov.


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


Re: [Haskell-cafe] bindings for libvirt

2012-01-23 Thread Ilya Portnov
On 16 янв, 03:27, Michael Litchard mich...@schmong.org wrote:
 Due to the direction things are going at work, I have become
 interested in Haskell bindings forlibvirt. Noticed that this hasn't
 been done yet. I was wondering if this was due to lack of motivation,
 or if there were some difficult hurdles withlibvirtthat make the
 project cost-prohibitive. If it's the former, I don't see a problem
 proceeding with exploration. If it's the latter, I'd like to know what
 the hurdles are.

Hello.

For my current projects, i'd also like to have bindings to libvirt. I
even started to write something for them, using c2hs. If someone is
interested, i could put my current (very basic) code to, say, github…

Seems there will no big problems, but libvirt API is not so small, so
it'll take time to write full bindings.

WBR, Ilya Portnov.

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