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
Sapozhnik
Jan 2, 2005

Nap Ghost

AlsoD posted:

The backend to Detexify is written in Haskell using Happstack, there's a link to the sources at the bottom of the page.

I'm the web development toolkit called loli

I kinda want to try Haskell at some point, but I need to solve a real problem with it, and a web application seems like the best way to go there, since the only thing webapps need to be able to speak is sockets (and some sort of data storage facility in order to actually be useful). Compare that to app development on client platforms, you're not going to write a Qt app in Haskell (well, you might, but that doesn't particularly seem like a fun time)

So I'm guessing there's no fancy-pants Haskell data stores out there, just libpq wrappers and whatnot?

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
the guy who made Haskell literally admitted its useless for anything other than a beta language for c# features. do not use Haskell unless you are beta testing new language features

power botton
Nov 2, 2011

why wouldn't you just test with f# then?

Shaggar
Apr 26, 2006
f# is basically Microsoft's internal Haskell that somehow escaped into the wild

power botton
Nov 2, 2011

exactly

gonadic io
Feb 16, 2011

>>=

Mr Dog posted:

I'm the web development toolkit called loli

I kinda want to try Haskell at some point, but I need to solve a real problem with it, and a web application seems like the best way to go there, since the only thing webapps need to be able to speak is sockets (and some sort of data storage facility in order to actually be useful). Compare that to app development on client platforms, you're not going to write a Qt app in Haskell (well, you might, but that doesn't particularly seem like a fun time)

So I'm guessing there's no fancy-pants Haskell data stores out there, just libpq wrappers and whatnot?

There's bindings to a bunch of databases (and QT for that matter) but if you want fancy-pants Haskell data store, I've heard good things about acid-state.

I'd really recommend going through Learn You A Haskell before trying to tackle anything big; I have spoken to a number of people who expect to be able to dive right in like they could with when switching to another j-lang and it rarely turns out well.

power botton
Nov 2, 2011

once again, just use yesod

gonadic io
Feb 16, 2011

>>=
Here's also an introduction to using OpenGL from Haskell: http://www.renci.org/wp-content/pub/tutorials/BeautifulCode.pdf

idk how accessible it would be to an absolute pre-syntax beginner though, I still think you should go through lyah first.

e: as to why learn haskell? most people ive spoken to who have done so said that it lead to them thinking about data a little differently and this translated through to their normal oo work. why immutable data is so good (remember if you really want to you can mutate your state*), why you'd want lambdas, to be more aware of your side effects, that kind of thing.

if you want to poo poo out another porn site then go ahead idc but if you want to expand your programming vocab than a functional lang (be it haskell or erlang or whatever) will do that

*: see this paper where the authors used mutable state to get good complexity in a core part of their library before hiding the mutable part and basing the rest of their (immutable) api on it: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.49.2591&rep=rep1&type=pdf

gonadic io fucked around with this message at 16:21 on Oct 14, 2013

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

the guy who made Haskell literally admitted its useless for anything other than a beta language for c# features. do not use Haskell unless you are beta testing new language features

he's pretty cool, i met him last week for a work thing

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Shaggar posted:

f# is basically Microsoft's internal Haskell that somehow escaped into the wild

actually it's their internal ml that escaped into the wild, but close enough for govt work

gonadic io
Feb 16, 2011

>>=
fwiw i'm sure that lens will be showing up in C# in about 5 years with bad syntax

tef
May 30, 2004

-> some l-system crap ->

Otto Skorzeny posted:

actually it's their internal ml that escaped into the wild, but close enough for govt work

i thought it was ocaml.net basically

Vanadium
Jan 8, 2005

I'm still sad not more languages adopted macros like Nemerle did, it's only ever ADTs and whatnot. :shobon:

tef
May 30, 2004

-> some l-system crap ->
php > $a = "2d9";
php > echo $a;
2d9
php > $a++;
php > echo $a;
2e0
php > $a++;
php > echo $a;
3
php >


:q:

X-BUM-RAIDER-X
May 7, 2008

tef posted:

php > $a = "2d9";
php > echo $a;
2d9
php > $a++;
php > echo $a;
2e0
php > $a++;
php > echo $a;
3
php >


:q:
lol. wontfix

Shaggar
Apr 26, 2006

tef posted:

php > $a = "2d9";
php > echo $a;
2d9
php > $a++;
php > echo $a;
2e0
php > $a++;
php > echo $a;
3
php >


:q:

ya. operator overloading is bad

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Vanadium posted:

I'm still sad not more languages adopted macros like Nemerle did, it's only ever ADTs and whatnot. :shobon:

had never heard of it before now

code:
macro @if (cond, e1, e2)
syntax ("if", "(", cond, ")", e1, Optional (";"), "else", e2)
{
  /*
    <[ ]> defines an area of quasi-quotation, the Nemerle compiler transforms a code in a such block
    to an AST tree, such transformations are somewhat similar to an Expression compiling in C#
  */
  <[
    match ($cond : bool)
    {
      | true => $e1
      | _ => $e2
    }
  ]>
}
 
// using this macro in code:
def max = if (a > b) a else b;
// during a compile time the upper line will be transformed to the following:
def max = match (a > b)
{
  | true => a
  | _    => b
}
maybe its because im a rubbish programmer, but the idea of working on other people's code when poo poo like that is central to the language is terrifying

Opinion Haver
Apr 9, 2007

AlsoD posted:

fwiw i'm sure that lens will be showing up in C# in about 5 years with bad syntax

one thing that i don't think people give lens enough credit for is that you can write your own lenses to view a data structure as something else, so you can write lenses that set bits/bytes of an integer like this:

code:
> set (bitAt 3) False (0xFF)
247
> view (bitAt 3) 0x8
True
> ((-1) :: Word16)^.byteAt 1
255
> byteAt 0 .~ 128 $ 65535
65408
(of course if you're doing more than a little bit twiddling you actually probably want to define your own adt, but that's not the point)

X-BUM-RAIDER-X
May 7, 2008

tef posted:

php > $a = "2d9";
php > echo $a;
2d9
php > $a++;
php > echo $a;
2e0
php > $a++;
php > echo $a;
3
php >


:q:

i actually thought the first increment was a cast to hex but 2d9+1 isn't 2e0 so idk

loving php i tell you

Vanadium
Jan 8, 2005

What, you don't want to write code that runs at compile time and implicitly defines a class hierarchy matching your database schema? Or define your language's basic loops as a macro wrapping lexical closures and recursion? Or write your own neat decorators/attributes/w/e? :getin:

I'm not sure it's really a good idea to use complex macros anywhere outside, like, a framework working up its way to a DSL, but it's kinda impressive how lightweight their mechanism for loving with the language's syntax is.

Vanadium
Jan 8, 2005

Also you didn't quote the xml literals. :(

Vanadium fucked around with this message at 17:21 on Oct 14, 2013

Shaggar
Apr 26, 2006
well that certainly is a thing

Zlodo
Nov 25, 2006

Vanadium posted:

What, you don't want to write code that runs at compile time and implicitly defines a class hierarchy matching your database schema? Or define your language's basic loops as a macro wrapping lexical closures and recursion? Or write your own neat decorators/attributes/w/e? :getin:

I think this kind of thing is pretty neat actually, I wish c++ would go there

its operator overloading and expression templates and constexpr functions (which are becoming much less limited in c++14) and other such things pushed to their logical conclusion

JewKiller 3000
Nov 28, 2006

by Lowtax

tef posted:

i thought it was ocaml.net basically

that's almost exactly what it is

Alligator
Jun 10, 2009

LOCK AND LOAF

tef posted:

php > $a = "2d9";
php > echo $a;
2d9
php > $a++;
php > echo $a;
2e0
php > $a++;
php > echo $a;
3
php >


:q:
what the heck is happening here, i can't make sense of this

Dicky B
Mar 23, 2004

Alligator posted:

PHP Megathread: what the heck is happening here, i can't make sense of this

PrBacterio
Jul 19, 2000
but seriously, in what way does php figure that the increment of 2d9 is 2e0?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Alligator posted:

what the heck is happening here, i can't make sense of this

hint: e is for exponential notation.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

PrBacterio posted:

but seriously, in what way does php figure that the increment of 2d9 is 2e0?

i guess you might not be familiar with the advanced concept of "carrying the one" if you didn't make it through elementary school

Opinion Haver
Apr 9, 2007

PrBacterio posted:

but seriously, in what way does php figure that the increment of 2d9 is 2e0?

well, you try to increment the last character, which is 9. 9+1=10, so you carry the 1 up. d + 1 is e, since it's 1 letter ahead.

code:
php > $x = "2x9";
php > $x++;
php > print $x;
php > echo $x;
2y0
note that this doesn't work if you do $x = $x + 1

also if you do $x = "zzz"; $x++; you get "aaaa". i guess this is to make autogenerating alphanumeric identifiers easier???

weird
Jun 4, 2012

by zen death robot

Vanadium posted:

I'm not sure it's really a good idea to use complex macros anywhere outside, like, a framework working up its way to a DSL, but it's kinda impressive how lightweight their mechanism for loving with the language's syntax is.

http://www.paulgraham.com/onlisp.html

wins32767
Mar 16, 2007

Tiny Bug Child posted:

hint: e is for exponential notation.

2^0 should be 1 no?

Opinion Haver
Apr 9, 2007

wins32767 posted:

2^0 should be 1 no?

http://en.wikipedia.org/wiki/Exponential_notation#E_notation

PrBacterio
Jul 19, 2000

wins32767 posted:

2^0 should be 1 no?

alright maybe this is all nothing but a huge troll but I though php's behaviour in that example was stupid before, but now there's people coming out of the woodwork saying that they seriously don't know how computer scientific/exponential floating point notation works, in a thread about programming

:psyduck:

Shaggar
Apr 26, 2006
most people don't ever use it while programming.

power botton
Nov 2, 2011

$("#submit").hidden(); is most of the coding anyone needs.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Tiny Bug Child posted:

i guess you might not be familiar with the advanced concept of "carrying the one" if you didn't make it through elementary school

rofl php is the worst

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
2d9 + 1 isn't 2e0 either.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

trex eaterofcadrs posted:

2d9 + 1 isn't 2e0 either.

yes it is. increment 9 and you get 10. carry the 1 and you have to increment d. increment d and you get e.

Adbot
ADBOT LOVES YOU

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
increment 9 and you get A. 2d9 + 1 = 2da. (actually '2d9' + 1 == 'Argument "2d9" isn't numeric in addition (+) at foo.pl line bar' but w/e)

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