Merijn Verstraaten | 17 Apr 16:19 2014
Picon

Proposal - Foreign enum support

Cross-post to haskell-prime in case there's any interest for including this into the report's FFI specification.

Proposal - Foreign enum support
===============================

At the moment the FFI does not have a convenient way with interacting enums
(whether proper enums or CPP defines) in C (like languages). Both enums and CPP
defined enums are major parts of large C APIs and they are thus crucial to
writing foreign bindings. A few examples:

SDL_image defines the following enum:

    typedef enum {
        IMG_INIT_JPG = 0x00000001,
        IMG_INIT_PNG = 0x00000002,
        IMG_INIT_TIF = 0x00000004,
        IMG_INIT_WEBP = 0x00000008
    } IMG_InitFlags;

OpenCL specifies the following typedefs + CPP defined enum:

    typedef uint32_t  cl_uint     __attribute__((aligned(4)));
    typedef cl_uint   cl_platform_info;

    /* cl_platform_info */
    #define CL_PLATFORM_PROFILE                         0x0900
    #define CL_PLATFORM_VERSION                         0x0901
    #define CL_PLATFORM_NAME                            0x0902
    #define CL_PLATFORM_VENDOR                          0x0903
    #define CL_PLATFORM_EXTENSIONS                      0x0904
(Continue reading)

Henk-Jan van Tuyl | 3 Feb 13:58 2014
Picon

Trac detected an internal error


L.S.,

I am trying to register as a user in the Haskell prime trac, but I get the  
error message:
---------------------------
Oops…
Trac detected an internal error:
IOError: [Errno 2] No such file or directory: ''

There was an internal error in Trac. It is recommended that you notify  
your local Trac administrator with the information needed to reproduce the  
issue.

To that end, you could   a ticket.

The action that triggered the error was:
POST: /register

TracGuide — The Trac User and Administration Guide
---------------------------

I tried to register with the browsers Opera, FireFox and Internet  
Explorer; each gave the same message.

Regards,
Henk-Jan van Tuyl

--

-- 
Folding <at> home
(Continue reading)

Herbert Valerio Riedel | 29 Jan 12:09 2014
Picon

Over/underflow semantics for 'Int' et al.

Hello *,

I'd like to point your attention to

 https://ghc.haskell.org/trac/ghc/ticket/8695

which brings up the issue what the results operations such as

 * `div minBound (-1)`
 * `quot minBound (-1)`
 * `abs minBound`

shall result in for the standard H2010 fixed-width signed types such as
`Int`, that is whether ⊥ (arithmetic overflow-exception) or
`minBound` is the more appropriate result.

Relevant sections from the Haskell 2010 report:

(http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1350006.4)

| 6.4. Numbers
|
| [...] The results of exceptional conditions (such as overflow or
| underflow) on the fixed-precision numeric types are undefined; an
| implementation may choose error (⊥, semantically), a truncated value,
| or a special value such as infinity, indefinite, etc.

...which seems contradictory to...

(http://www.haskell.org/onlinereport/haskell2010/haskellch18.html#x26-22400018.1)
(Continue reading)

Ramin Honary | 9 Jan 08:46 2014
Picon

Hiding top level declaration with tilde

Hello,

I did some Googling, and read a bit through the Haskell 2010 report, Chapter 5 "Modules," and searched through the Haskell-prime Trac tickets and can't really find anything on this. I don't know if it has ever been suggested before, or the reasoning for how export lists work the way they do.

So as we all know, when there is no exports list in a module declaration, everything in the top level is exported by default. If you provide an exports list, everything is hidden except what you declare in the exports list.

I think a good way to hide things without an exports list might be to simply prefix the type signature with a tilde character. For example:

    module M where

    ~type A = ()
    ~newtype B = B ()
    ~data C = MkB1 () | MkB2 ()
    
    ~abc :: ()
    abc = ()
    
    increment :: Int -> Int
    increment = (+1)

So in this example, the module M would only export the "increment" function, everything else would be hidden.

Right now, this would produce a compile-time error like:
    Invalid type signature: ~abc :: ()

I propose making this kind of expression legal and effecting whether or not the symbol is exported.

The only disadvantage I can think of is that tilde is generally reserved for making things more lazy, and using tilde in a way that has nothing to do with lazyness, it could make the language a bit more confusing. Otherwise I think it is very practical.


_______________________________________________
Haskell-prime mailing list
Haskell-prime@...
http://www.haskell.org/mailman/listinfo/haskell-prime
Benjamin Franksen | 4 Dec 14:38 2013
Picon

getWorkingDirectory/changeWorkingDirectory

Module System.Posix.Directory of the unix package defines

  getWorkingDirectory :: IO FilePath
  changeWorkingDirectory :: FilePath -> IO ()

I believe the functionality is quite portable and not limited to unix-like 
systems. I know that e.g. Windows has chdir and getcwd. Module Filesystem of 
the system-fileio package has

  getWorkingDirectory :: IO FilePath
  setWorkingDirectory :: FilePath -> IO ()

I propose to add these functions to System.Environmant or maybe 
System.Directory.

Rationale:

(1) This is standard functionality that should at least be in the Haskell 
Platform, if not in the standard libraries.

(2) I would like to avoid depending on an extra package just to have these 
two very basic functions available in a OS independent way.

(3) "system-fileio".Filesystem does not seem to be the right place for this. 

The last point may be arguable, but the first two are plain common sense 
IMO.

Cheers
Ben
--

-- 
"Make it so they have to reboot after every typo." ? Scott Adams
Ed Soares | 24 Nov 04:41 2013
Picon

Lista de emails trabalho com mala direta mala direta como fazer

Lista de emails trabalho com mala direta mala direta como fazer lista de mail também lista de emails,
cadastro email lista email:    http://www.maladiretaemails.com    Nós sabemos que list mail, é muito
legal para a maioria das pessoas. endereco de email listas email  e acima de tudo lista de emails, email de
empresas o que e mailing, o objetivo de nosso website. se você busca emails de pessoas, email marketing e
também email mailing:    http://www.maladiretaemails.com 

é excelente listas de emails tais como lista email, endereco de email lista com emails. é fantástico
emails de pessoas e, além disso lista email. envio de emails email cadastro, marketing email. 

atualmente lista de email compreendendo Enviar email, newsletter pode ser bastante bom. é realmente a
função do nosso website: cadastro email, Enviar email, e bem como listas de emails. Oferecemos o melhor
em lista de email listas de emails, envio de emails. 
Nikita Volkov | 14 Oct 18:13 2013
Picon

Anonymous records. A solution to the problems of record-system.

Anonymous records. A solution to the problems of record-system.

The current record system is notorious for three major flaws:

  1. It does not solve the namespacing problem. I.e., you cannot have two records sharing field names in a single module. E.g., the following won't compile:

    data A = A { field :: String } data B = B { field :: String }
  2. It's partial. The following code will result in a runtime error:

    data A = A1 { field1 :: String } | A2 { field2 :: String } main = print $ field1 $ A2 "abc"
  3. It does not allow you to use the same field name for different types across constructors:

    data A = A1 { field :: String } | A2 { field :: Int }

This proposal approaches all the problems above and also a fourth one, which is unrelated to the current record system: it allows one to avoid declaration of intermediate types (see details below).

Gentlemen, I want you to meet,

Anonymous Records

When a record-syntax is used in Haskell it's almost always a single-constructor ADT. A question rises then: why use ADT when you don't need its main feature (i.e., the multiple constructors)? This main feature is actually the root of the second and the third problem of record-syntax from the list above. In such situations one doesn't actually need ADT, but something more like a tuple with ability to access its items by name. E.g.:

f :: (a :: Int, b :: String) -> String f rec = rec.b ++ show rec.a

application:

f (a = 123, b = "abc")

So now you think "Okay, but how about naming it?". Well, not a problem at all - use the existingtype-construct:

type TheRecord = (a :: Int, b :: String)

Now, about the avoidance of intermediate types:

type Person = (name :: String, phone :: (country :: Int, area :: Int, number :: Int))

See? No need to declare separate types for inner values. But, of course, if you need, you still can:

type Phone = (country :: Int, area :: Int, number :: Int) type Person = (name :: String, phone :: Phone)

We can nicely access the deeply nested fields, e.g.:

personCountryCode :: Person -> Int personCountryCode person = person.phone.country

Okay. What about the type ambiguity? E.g., in the following the Person is actually the same type asCompany:

type Person = (name :: String, phone :: Phone) type Company = (name :: String, phone :: Phone)

Easily solvable with a help of newtype:

newtype Person = Person (name :: String, phone :: Phone) newtype Company = Company (name :: String, phone :: Phone)

What about ADTs? Again, easy:

data Product = Tea (brand :: Company) | Milk (brand :: Company, fatness :: Float)

Now, the beautiful fact:

This solution does not conflict with any existing feature of Haskell! As the examples show, it easily fits into the language as an extension. It can peacefully coexist with the existing record system of ADTs. Hence a complete backwards compatibility with old codebase. There's also a potential for many other additional features.

Links

_______________________________________________
Haskell-prime mailing list
Haskell-prime@...
http://www.haskell.org/mailman/listinfo/haskell-prime
Andreas Abel | 10 Jul 09:08 2013
Picon

Proposal: Non-recursive let

Proposal: add a non-recursive let to the Haskell language.  In

   let' p = e in e'
   do { ... let' p = e ... }

the variables of pattern p are then *not* in scope in e.

Reasons for adding a non-recursive let:

1. recursive-let is the source for many non-termination bugs.

An instance of such a bug is in the state monad of mtl-2.1 (forgive me, 
Edward, for quoting this again):

http://hackage.haskell.org/packages/archive/mtl/2.1/doc/html/src/Control-Monad-State-Class.html#state 

     state :: (s -> (a, s)) -> m a
     state f = do
       s <- get
       let ~(a, s) = f s
       put s
       return a

here, a non-recursive let was meant, the s bound by the let was supposed 
to be a new state, shadowing the old state.  However, since let is 
recursive, this actually causes a loop.

Another instance (cut-down) are let-guards like

   let Just x | x > 0 = e in x

The "x > 0" is understood as an assertion here, documenting an 
invariant.  However, Haskell reads this as

   let Just x = case () of { () | x > 0 -> e } in x

leading to non-termination.  A non-recursive version

   let' Just x | x > 0 = e in x

could be interpreted as

   case e of { Just x | x > 0 -> x }

instead, which is meaningful (in contrast to the current interpretation).

2.  Connected to 1., a non-recursive let allows for painless shadowing.

For instance, the hack

   do ...
      x <- return $ f x

exploiting non-recursiveness of the <- binding, would be unnecessary, 
instead we could write

   do ...
      let' x = f x

NB: In a do-Block, we could drop the keyword let' and simply write

   do ...
      x = f x

for a non-monadic binding, in accordance to x <- mf x,

See also

   http://www.haskell.org/pipermail/beginners/2009-February/001075.html

http://stackoverflow.com/questions/8398607/declaration-order-in-let-bindings-haskell-vs-ocaml

PS.:  I can work out the details of grammar and semantics if this 
proposal finds followers.

Cheers,
Andreas

--

-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel@...
http://www2.tcs.ifi.lmu.de/~abel/
Wvv | 29 Jun 13:20 2013
Picon

Interfaces - the Golden Path of Haskell?

This is fairly the same as 
http://hackage.haskell.org/trac/ghc/ticket/8021
but it's rewritten a little

Interfaces

Interface is a generalization of the class.

Now class become just *instances* of interface

For backward compatibility compiler should calculate interface by itself,
but it should allow to write interfaces to everybody (more detail at "Maybe
Problems").

 /-- it is calculated by the Compiler or is written directly/
 class interface Monoid (a :: k) where      /-- like Typeable/
    mempty  :: *            
    mappend :: * -> * -> *  

  class Monoid a where ... 

  class Monad m => Monoid m where ... 

  class Arrow c => Monoid c where ...

It is easy to use them with functions:

  foo :: (Monad m => Monoid m , Monad m ) => m a
  bar :: (Arrow c  => Monoid c, Arrow c) => c b a

These classes are open, you could lately add 
class MyClass c  => Monoid c where ...

We use like Typeable (a :: k)  because:

() => Monoid a      :: *
Monad m => Monoid m :: * -> *
Arrow c => Monoid c :: * -> * -> *

Backward compatibility

 If class have single constraint, you could write without it. 

 If class have many constraints, you could write without it, if it is empty
one. 

  bar :: MonadPlus m => m a  <<==>>  bar :: () => Monad m => MonadPlus m =>
m a 

  foo :: Monoid a => a          <<==>>  foo :: () => Monoid a => a

  baz :: Monad m => Monoid m => m a  <<==>> baz :: () => Monad m => Monoid m
=> m a

Better than superclasses

  we already have 
  class Num a where ...

But we wish to generalize it.
It's easy now, we just add:

  class Additive a where
     addplus = ...

  class Multiplicative a where
    multprod = ...

  class (Additive a, Multiplicative a) => Num a where
     (+) = addplus
     (*) = multprod

  foo :: (Additive a, Multiplicative a) => Num a => a -> a -> a

Maybe Problems

1)
     If we have already class 

     class Foo a where
        data F :: ...
        type S :: ...
        data family G ...

what interface do we have ?
Possible reply - no data in the interface.

2) What is the interface of Typeable ?
2.1) What is the interface of class with unwritten interface?

Possible reply - the same as class, so it is easy to Compiler.

3) 
 Misfeature - to allow write interface manually
 Why? You can't change it later.
 So, it must be deprecated from the beginning.

--
View this message in context: http://haskell.1045720.n5.nabble.com/Interfaces-the-Golden-Path-of-Haskell-tp5732208.html
Sent from the Haskell - Haskell-prime mailing list archive at Nabble.com.
harry | 11 Jun 12:51 2013
Picon

Remove Enum from Float and Double

There have been several discussions over the years regarding Enum instances
for Float and Double. The conclusion each time appears to have been that
there are no instances which are both sane and practical.

I would like to propose that these instances be removed from Haskell 2014.
This may be covered by the various alternative prelude and number class
proposals, but they are much more ambitious and less likely to make it into
the standard in the short term.
Edson | 29 May 09:03 2013
Picon

Aprovados lista publicada Senador Guiomard

Aprovados lista publicada Senador Guiomard:

Pedra Preta: ALANA KELLY AFIO CAETANO, KARLA ALEXSANDRA LEITAO LIMA, FABIANA MAIA DE ALCANTARA, MÔNICA
MÁRCIA DE LIMA, JOÃO CARLOS MOREIRA DE CARVALHO, CATARINA LABORE VIDAL FERNANDES, MARCELA TEOFILO
BARROSO, IKARO GABRIEL CAVALCANTE MONTEIRO PINHEIRO. ROMÁRIO JOSÉ REZENDE DE BRITO, EDNAIRAN DOS
SANTOS MARTINS, MARINALDO MANOEL DA SILVA JUNIOR, JOSÉ ELYELSON MARQUES TORRES, VALCLEIDE DOS SANTOS
MENDES. Guimarães.

Senador Guiomard, ANA CLARA DE MORAES HOLANDA, LORENNA DOS SANTOS SILVA, FRANCISCO JEFERSON GUERRA DA
COSTA, PEDRO AMARANTE SILVA FILHO, JOÃO CARLOS MOREIRA DE CARVALHO, DANIEL AGUIAR DE SOUSA, MARIA
ISABELA DE BRITO MORAIS, JARDEL SOUSA DA SILVA. SILVANA FERREIRA DE ARAÚJO, ARTHUR MAURICIO DE SOUZA
RODRIGUES, LUCAS RAMOS DE LIMA, GLEYCIANNE M. DE CARVALHO, REBECCA ERONIDES NOJOSA ARRUDA.
Brasópolis. 

Mucugê e ANNIBERG CORDEIRO DE SOUZA SILVA, LUCAS FONTENELE SILVA DE CARVALHO, GERLANDE MARIA FERREIRA,
RAFAELLA SAMPAIO DE ALENCAR, JOÃO CARLOS MOREIRA DE CARVALHO, DENISE ARAÚJO JUSTINO, MARIA NIVANEIDE
DE ABREU LIMA, JOELMA CÂNDIDO DA SILVA. TERESA RAQUEL DE MORAES ANDRADE, CARLA NAYANNE MOREIRA DE SOUZA,
MAIRA NOGUEIRA ALVES, IAN VIEIRA LIMA AMORA DE SOUZA, ROBERTO ALMEIDA PIRES. Inaciolândia.

Gmane