Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Wheelchair Stunts
Dec 17, 2005
I tried to compile some C code, but I was told to get a.out

Adbot
ADBOT LOVES YOU

skeevy achievements
Feb 25, 2008

by merry exmarx

tef posted:

I think my favourite thing (of late) to come out of the haskell swamp is this
http://research.microsoft.com/en-us/people/dimitris/icfp12.pdf

(they've found a way to compile code with type errors, almost as if you were using a dynamic language :q:)

so what is that a compiler error or something

I thought one of haskell's raisons d'etre was strong static typing always

JawnV6
Jul 4, 2004

So hot ...

lamentable dustman posted:

didn't read much of this but learn java because there literally isn't enough java programers in the world

XY problem

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
java is really easy

Sniep
Mar 28, 2004

All I needed was that fatty blunt...



King of Breakfast
much like your mom

Shaggar
Apr 26, 2006
Java is the best.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Shaggar posted:

Java is the best.

Sniep posted:

much like your mom

(US mothers day reminder)

skeevy achievements
Feb 25, 2008

by merry exmarx

Shaggar posted:

The JVM is the best.

graph
Nov 22, 2006

aaag peanuts
JVM is hiding out in barcelona because he never paid any taxes on either delta heavy tour, lol

Opinion Haver
Apr 9, 2007

Internaut! posted:

so what is that a compiler error or something

I thought one of haskell's raisons d'etre was strong static typing always

I mean the point is that it's disabled by default but you can enable it while developing if you don't feel like fixing other parts of your code. obviously if you use that for production builds you're missing the entire point of haskell

penus de milo
Mar 9, 2002

CHAR CHAR

yaoi prophet posted:

I mean the point is that it's disabled by default but you can enable it while developing if you don't feel like fixing other parts of your code. obviously if you use that for production builds you're missing the entire point of haskell

if you use haskell for production builds you're missing the entire point of haskell

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Char posted:

if you use haskell for production builds you're missing the entire point of haskell
what else would you use haskell for?

penus de milo
Mar 9, 2002

CHAR CHAR

Janin posted:

what else would you use haskell for?

this is a trick question right

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Char posted:

this is a trick question right
no, I'm serious.

between its strong type system, good performance, and easy C binding system, it's practically ideal for writing reliable production services.

I can't really think of what else you'd use it for; static typing is annoying for small scripts, and Haskell binaries are too large to use in embedded systems.

ppp
Feb 13, 2012

by angerbot
i thought validated languages were a solved problem with ada

Opinion Haver
Apr 9, 2007

Janin posted:

I can't really think of what else you'd use it for; static typing is annoying for small scripts, and Haskell binaries are too large to use in embedded systems.

qft, if you link hxt which is one of the heavy-duty xml processing libraries you get like 30 extra megs on your binary, 20 if you strip it

i dunno if i agree about it being annoying for small scripts though, it just catches your stupid logic errors at compile time instead of runtime. then again it can be annoying dealing with Text values and having to throw T.pack and T.unpack everywhere because some other module uses Strings

ppp
Feb 13, 2012

by angerbot
id tech 6 is going to be done in haskell and carmack is going to ship you a certificate of code validity with every copy of doom 4

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

ppp posted:

i thought validated languages were a solved problem with ada
you can write validated code in any language; advanced features like those in haskell's type system just make it easier.

yaoi prophet posted:

qft, if you link hxt which is one of the heavy-duty xml processing libraries you get like 30 extra megs on your binary, 20 if you strip it
ugh, fuckin' hxt. I had to remove it from all my library dependencies because it was just too big and had too many dependencies.

why yes, I would like to install three hundred megs of dependencies to parse a 1kB xml document!!!

penus de milo
Mar 9, 2002

CHAR CHAR
i take it all back i didn't realise janin would show up while i was taking cheap shots at haskell

i'm in over my head here

Sniep
Mar 28, 2004

All I needed was that fatty blunt...



King of Breakfast
janined again

MononcQc
May 29, 2007

Janin posted:

you can write validated code in any language; advanced features like those in haskell's type system just make it easier.

It just sucks that some things like 'forall' for types ends up being overloaded depending on what compiler extension is plugged in.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Internaut! posted:

speaking of haskell janin how painless is C and C++ interop, I've taken this little clojure side project as far as it can go and it's been fun but it's not like I actually planned to suggest dropping a JVM bollock into our core trade switching punchbowl
Bindings to C++ are painful. Since there's no standard ABI, you basically have to wrap all of the C++ bits in C functions.

Bindings to old-fashioned C can be a *little* iffy if your library's interface uses language features that don't have a direct Haskell equivalent, such as static global initialisation. These are widely regarded as poor design, so they aren't common, but if you're writing a binding to a library written in the '80s then you're in for some adventure.

Bindings to modern C are trivially easy, there are tools that will parse C header files and generate all the stubs for you. Runtime overhead is low since calling a foreign function is literally just a standard C procedure call. Basically you just say "here's a header, here's the function I want" and then you compile and you've got a usable binding.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

MononcQc posted:

It just sucks that some things like 'forall' for types ends up being overloaded depending on what compiler extension is plugged in.
Not sure what you mean here; keyword "forall" is (as far as I know) only used by the Rank2Types/RankNTypes, and ExistentialQuantification extensions. Sure, it's the same keyword, but the context makes it pretty obvious as to how it's being used, and the semantics are pretty similar either way.

I try to avoid all the scary-named extensions so maybe there's some out there that do additional weird stuff with it, idk.

Opinion Haver
Apr 9, 2007

wait how do you generate the foreign import declarations from header files

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

yaoi prophet posted:

wait how do you generate the foreign import declarations from header files

very carefully

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

yaoi prophet posted:

wait how do you generate the foreign import declarations from header files
start with a C source and header file

code:
/* yospos.h */
void yospos_bitch(const char *msg);

/* yospos.c */
#include <stdio.h>
void yospos_bitch(const char *msg) {
    printf("%s; yospos, bitch\n");
}
then you write a haskell file with some c2hs statements, and give it the .chs extension so Cabal will preprocess it automatically

code:
-- hs-yospos.chs
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign
import Foreign.C

#include "yospos.h"

yosposBitch :: String -> IO ()
yosposBitch msg = withCString msg {# call yospos_bitch #}

main = yosposBitch "haskell owns"
then build and run:

code:
$ gcc -c yospos.c
$ c2hs hs-yospos.chs 
$ ghc --make -o yospos hs-yospos.hs yospos.o
[1 of 1] Compiling Main             ( hs-yospos.hs, hs-yospos.o )
Linking yospos ...
$ ./yospos 
haskell owns; yospos, bitch

TOO SCSI FOR MY CAT fucked around with this message at 04:19 on May 12, 2012

Opinion Haver
Apr 9, 2007

drat i didn't know about that, that's pretty awesome

Opinion Haver
Apr 9, 2007

the one feature i really wish haskell had was the ability to say 'ok what type does x have to be for this to typecheck', you can do it manually via implicits (which is the only time i've ever seen anybody use implicits) but having something like agda's holes would be gr8

skeevy achievements
Feb 25, 2008

by merry exmarx

Janin posted:

Bindings to modern C are trivially easy, there are tools that will parse C header files and generate all the stubs for you. Runtime overhead is low since calling a foreign function is literally just a standard C procedure call. Basically you just say "here's a header, here's the function I want" and then you compile and you've got a usable binding.

perfect, and how about the reverse? this code chunk I'm looking at has hundreds of C tests making direct function calls, if there's an easy way I can adapt/reuse those tests then that would both save a lot of time and make the approach easier to sell up

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

yaoi prophet posted:

the one feature i really wish haskell had was the ability to say 'ok what type does x have to be for this to typecheck', you can do it manually via implicits (which is the only time i've ever seen anybody use implicits) but having something like agda's holes would be gr8
I don't understand what this means, or how implicit parameters would support it. Could you give an example?

Internaut! posted:

perfect, and how about the reverse? this code chunk I'm looking at has hundreds of C tests making direct function calls, if there's an easy way I can adapt/reuse those tests then that would both save a lot of time and make the approach easier to sell up
I don't think there's any tool that will generate export declarations for you, sorry; you'll have to write them out by hand (though you could use c2hs to do typechecking, if you use either CPP or TH).

Opinion Haver
Apr 9, 2007

Janin posted:

I don't understand what this means, or how implicit parameters would support it. Could you give an example?

code:
Prelude> :set -XImplicitParams 
Prelude> let foo x = map ?f x
Prelude> :t foo
foo :: (?f::a -> b) => [a] -> [b]
useful for if you're two-deep in where bindings so you can't just use :t

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
http://utf-8.jp/public/aaencode.html

Necc0
Jun 30, 2005

by exmarx
Broken Cake
the only thing that bugs me is new languages arbitrarily giving old concepts/structures/architectures new names but whatever

JawnV6
Jul 4, 2004

So hot ...
I am sorry that, instead of educating you, the leaders in this language community have given you lies and fear. That was shameful. I recommend learning how statements in JS are actually terminated (and in which cases they are not terminated), so that you can write code that you find beautiful.

jony neuemonic
Nov 13, 2009

JawnV6 posted:

I am sorry that, instead of educating you, the leaders in this language community have given you lies and fear. That was shameful. I recommend learning how statements in JS are actually terminated (and in which cases they are not terminated), so that you can write code that you find beautiful.

i like javascript as much as the next guy but the people who write it are terrible

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post

fidel sarcastro posted:

i like yospos as much as the next guy but the people who post in it are terrible

Nomnom Cookie
Aug 30, 2009



im kinda pissed at java guys, they act like gc is super cool and everyone should use it and then when your heap gets over a couple gigs they're like "oh, you were going to *use* that heap? lol sucks to be you". at this point it looks like my best option is to break the one monster jvm into a bunch of little ones that can full collect independently and do something dumb to serialize requests to each baby jvm. all because I'm too dumb to manage my own memory and don't get to have memory pools

CaptainMeatpants
Jun 1, 2010

javascript is super cool except if you want to do something useful

CaptainMeatpants
Jun 1, 2010

actually even then it's kind of poo poo

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



javascript is how you tell whether you're using a lovely language, by whether it makes JS look good or bad. js is the SI standard for meh in PL design

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply