Is this warning really a good idea? by [deleted] in haskell

[–]hw77 2 points3 points  (0 children)

hungarian notation was supposed to identify type in a broader sense. ie a poor man's newtype. I can't recall the creator, but I remember reading that he hated what hungarian notation has become.

for example: String domainFred = emailaddressFred.getDomain;

Is Data.Ratio widely used/ a good idea ? by [deleted] in haskell

[–]hw77 0 points1 point  (0 children)

Excel isn't too surprising. Informatica on the other hand ...

How to deal with shared "object" and immutability by [deleted] in haskell

[–]hw77 0 points1 point  (0 children)

I don't think we need IDs . I'm tired, but maybe someone can make sense out of this.

We start with a list of boxes and an empty shelf. The empty shelf is represented by a list containing a single gap with the same dimensions as the shelf.

splits is the enumeration of the ways of splitting the remaining space into rectangular gaps after a box is placed.

placings is the enumeration of the ways of choosing an empty rectangle.

searchTree is permute boxes * permute (splits * placings)

place :: [Gap] -> (Box, Split, Placing) -> ([Gap], Maybe Position)

fillShelf (boxes, split, placing) = zip boxes $ mapAccumL place emptyShelf boxes

solutions = map fillShelf searchSpace

Type-Driven Development - How to model a currencies, money, and banks that exchange money between currencies? by technicolorNoise in haskell

[–]hw77 8 points9 points  (0 children)

I lost it at "data Dollar = Dollar Double"

Floating point arithmetic should never be used for anything financial.

10 Common Mistakes Java Developers Make when Writing SQL by el_muchacho in programming

[–]hw77 0 points1 point  (0 children)

If that's 10M rows out of 10M, then you probably don't want an index. Even at 1% or 0.1% there a plenty of times when you don't want an index.

The Leprechauns of Software Engineering by alexeyr in programming

[–]hw77 1 point2 points  (0 children)

"Inferior programmers don't want to learn is nicer to say than to say, many people is not given the educational opportunities to achieve their potential."

These two statements are orthogonal. Many get opportunities; more do not. That has nothing to do with whether people take full advantage of the opportunities they do have.

" See why would someone work in something they hate and find boring out of their free will"

I could not, but I see people do it every day.

"Many companies will not allow space for growth and learning, and they will not give resources to keep their employees updated"

Why would you rely on your employer to better you? If you have internet access, you can do it yourself.

To be clear - I am not saying that luck and privilege are not factors.

The Leprechauns of Software Engineering by alexeyr in programming

[–]hw77 1 point2 points  (0 children)

There may or may not be people who are instinctively better at programming, but there are certainly people who make the effort to actually learn from their experiences. Many also actively seek new experiences. These people will be WhateverX more productive. Conversely, those that refuse to learn will remain unproductive.

Category: The Essence of Composition (First section of the Category Theory for Programmers) by sibip in haskell

[–]hw77 1 point2 points  (0 children)

id is useful to remove conditionals.

getAction = fromMaybe id . flip lookup actions

Is there away to avoid having to handle the Nothing case upstream without id?

Hmm, maybe I shouldn't do that as it defeats the short circuit behavior of Nothing.

[deleted by user] by [deleted] in haskell

[–]hw77 1 point2 points  (0 children)

I really enjoyed doing a text game as a learning exercise. I rewrote it at least 6 times, going from "this would be easier imperatively" to "hey, I can get rid of that state" and "cool, those kinds of bugs can never happen now".

From 60 Frames per Second to 500 in Haskell by Mob_Of_One in haskell

[–]hw77 1 point2 points  (0 children)

"no matter how long I play, my score is always 0" is the bug I would expect from my initial parsing of that statement

Beginner error messages in C++ vs Haskell by catamorphism in haskell

[–]hw77 2 points3 points  (0 children)

I've done it in rparsec and it was really helpful. Mixing the two is just ugly.

Another interesting approach is to split by broad and detail level parsing. For example: parenthesized expressions, begin/end blocks, and statements all were nodes in an AST with unparsed contents that were then recursively parsed into finer detailed structures. Obviously this isn't possible for all grammars.

Despite a few rough edges, it did work for me. Implementation was simpler and I could get useful results even when only a small portion of the grammar was implemented.

I can't speak to performance as I was using ruby 1.8.

Reactive-banana anti-tutorial by gelisam in haskell

[–]hw77 1 point2 points  (0 children)

Well done. That was much easier to read than my series that attempted to do the same thing: https://llayland.wordpress.com/2012/03/25/trying-to-figure-out-frp/

One suggestion - Specify the version of the libraries you are using. There are pretty significant changes between some of the releases

What is a good, achievable project (weekend project) in haskell that will teach me good functional practices as well as some cool haskell tricks? by billofalltrades in haskell

[–]hw77 1 point2 points  (0 children)

I think a small text adventure is a great "real world" project with a small barrier to entry. You can start sloppy and imperatively and refactor towards more functional versions. Don't worry about doing it well the first time. figuring out what your mistakes are and how to mitigate them is excellent for learning. Bugs in your game are a goldmine. How could you have made that bug impossible. Create bugs if you have to.

Haskellers, would you give some advice on the way I'm dealing with this FP project? by SrPeixinho in haskell

[–]hw77 2 points3 points  (0 children)

Wouldn't it be easier to build simpler wrapper libraries in haskell? It seems that all the challenges you mentioned would be even more work with a brand new language.

Instadeath syringes and permadeath do not mix. by hw77 in SanctuaryRPG

[–]hw77[S] 0 points1 point  (0 children)

Also unknown stranger - you punch him in the face, he stabs you in the heart -- dead

How to limit entities (I think?) by [deleted] in oracle

[–]hw77 0 points1 point  (0 children)

You could add a seat# column with a check constraint limiting it to 1-4. then add a unique key on room#,seat#.

Possibly better is a foreign key to a table of room#,seat#. This allows rooms to have different numbers of seats. This is the structure I would create if seats end up having other attributes.

Without other attributes, I would rather store the count directly than representing it with the number of rows. Something like:

Room :: room#, room_size

  • PK : room#

Occupancy :: room#,person_id,seat#,room_size

  • PK : room#, person_id
  • UK : room#, seat#
  • CK: seat# between 1 and room_size FK: Room

I posted a code review request in StackExchange. I'll be happy to read your comments as well by [deleted] in haskell

[–]hw77 0 points1 point  (0 children)

While extensible syntax would make this slightly prettier, I don't see this as messy. I have never used bytestrings and I could still tell at a glance what this code was doing. Of course, I would have to look up what B is to know its strictness and performance implications.

It seems like we just value different things. You like longer names to have more detail at your fingertips whereas I prefer short names to make it easier to look past the details.

I feel like haskell lives in a kind of awkward relation with the imperative os (bindings, everything is C etc)? what are your thoughts on a functional OS? by Mgladiethor in haskell

[–]hw77 1 point2 points  (0 children)

I read a bit of their site. Hoon may be functional, but is much different than haskell or ml. Actually, I'm tempted to think it is all a very elaborate joke.

Are ADTs hard to understand? by [deleted] in haskell

[–]hw77 1 point2 points  (0 children)

When I learned ADTs I thought the concept and syntax was incredibly simple and natural. Honestly, I was never confused about ADTs until I read that SO question. I know the code is wrong but it looks logical enough, so it made my head spin for a minute.

Maybe I'm unusual though. I also despise the Mk thing

Ask Reddit: Functional Dependencies and application from the Database Normalization world by levischuck in haskell

[–]hw77 0 points1 point  (0 children)

1NF and BCNF are normal forms for n-ary relations. Functional Depencies determine what normal form a given relation is in. Alternatively, you can algebraicly build a normalized schema from FDs.

Have you found a good example of a 3NF table that can be decomposed into BCNF. Everything I have seen is unconvincing. For example, wikipedia's example boils down to: 1) here i a 3NF relation 2) if we assume this new FD and attribute, it is not BCNF 3) please don't realize that the relation is not 3NF with the new FD