ELLIOTTCABLE changed the topic of #elliottcable to: screw syntax, make neat languages
eligrey has joined #elliottcable
oldskirt_ has joined #elliottcable
oldskirt has quit [Ping timeout: 245 seconds]
<devyn> gkatsev: lol
<purr> lol
Willox_ is now known as Willox
alexgordon has quit [Quit: Textual IRC Client: www.textualapp.com]
Rusky has quit [Quit: Leaving.]
Rusky has joined #elliottcable
Rusky has quit [Quit: Leaving.]
Rusky has joined #elliottcable
Rusky has quit [Quit: Leaving.]
Rusky has joined #elliottcable
Rusky has quit [Read error: Connection reset by peer]
Rusky1 has joined #elliottcable
Rusky1 is now known as Rusky
sharkbot has quit [Remote host closed the connection]
sharkbot has joined #elliottcable
eligrey has quit [Quit: Leaving]
prophile has joined #elliottcable
aboutGod has joined #elliottcable
aboutGod has left #elliottcable [#elliottcable]
vil has quit [Ping timeout: 252 seconds]
<devyn> 1986 - Brad Cox and Tom Love create Objective-C, announcing "this language has all the memory safety of C combined with all the blazing speed of Smalltalk." Modern historians suspect the two were dyslexic.
prophile has quit [Quit: The Game]
yorick has joined #elliottcable
vil has joined #elliottcable
Sgeo has quit [Read error: Connection reset by peer]
Rusky has quit [Read error: Connection reset by peer]
Rusky1 has joined #elliottcable
Rusky1 has quit [Ping timeout: 252 seconds]
alexgordon has joined #elliottcable
eligrey has joined #elliottcable
Rusky has joined #elliottcable
Sgeo has joined #elliottcable
<alexgordon> HM
<alexgordon> I always thought I couldn't make a 3D game because I didn't know any artists
<alexgordon> but it turns out you can just pirate that shit
<joelteon> artists?
<cloudhead> any haskell people here?
<cloudhead> joelteon?
<joelteon> hi
<purr> joelteon: hi!
<joelteon> cloudhead: what
<cloudhead> joelteon: you good with haskell by any chance?
<joelteon> yes
<cloudhead> \o/
<cloudhead> I'm wondering what's the best approach if I have a hashmap of a certain enum-like datatype
<cloudhead> something like
<cloudhead> data Foo = A | B | C
<cloudhead> how would I key that?
<cloudhead> is there any way to reuse those symbols
<cloudhead> or do I have to do something like..
<cloudhead> data FooType = TypeA | TypeB | TypeC
<joelteon> wait what
<joelteon> can you show me your code
<joelteon> i don't understand at all
<cloudhead> haha
<cloudhead> well
<cloudhead> HashMap k v
<cloudhead> is the type
<cloudhead> v is Foo
<joelteon> ok
<cloudhead> so HashMap k Foo
<joelteon> ok
<cloudhead> I'm wondering what type should k be
<joelteon> uhhh
<joelteon> why are you storing a map of foos
<joelteon> what are you using to look up
<cloudhead> well, essentially I have different kinds of Foos, I want to be able to retrieve a specific one
<cloudhead> maybe I should be using typeclasses I'm not sure : /
<joelteon> i don't understand, this is way too abstract for me
<joelteon> "i have a map of values. what should the keys be?"
<joelteon> depends on your use case
<cloudhead> haha, ok
<cloudhead> let me explain the case
<cloudhead> I have these nodes in a tree
<cloudhead> each node has different capabilities
<cloudhead> these capabilities are represent as "Components"
<cloudhead> a node can have N components
<cloudhead> there are many different components types. each node can only have zero or one of each type
<cloudhead> so basically I started with something like
<cloudhead> data Node = Node [Component]
<joelteon> but lookup is linear
<joelteon> use a Set
<cloudhead> data Component = A | B | C..
<cloudhead> yes, so then I tried Set
<cloudhead> but I can't lookup a single component easily
<cloudhead> I'd have to convert it to a list
<cloudhead> so now I'm looking at HashMap..
<joelteon> so `elem A components` doesn't work?
<cloudhead> is elem on functor or something?
<cloudhead> cause it's not part of Data.Set
<cloudhead> not functor
<cloudhead> but some other typeclass
<joelteon> is it member
<joelteon> I don't remember
<cloudhead> member just returns a Bool
<joelteon> it's member
<joelteon> right
<cloudhead> I'm storing actual data I need to retrieve
<cloudhead> so like, each component has associated data
<cloudhead> so it's kind of like
<cloudhead> data Component = A String | B Int Int | C Float Float
<joelteon> oh
<cloudhead> I was thinking I might have to do `data Component = Component { typ :: ComponentType, d :: ComponentData }
<joelteon> how long is the components list
<cloudhead> there's about 12 components at the moment
<joelteon> how many are you planning to add
<cloudhead> hmm, < 100 I'd say total
<cloudhead> each node will probably have 10-20 max
<joelteon> sure, make a separate Key type then i'd say
<cloudhead> right
<joelteon> or make Components a datatype instead of a list of Components
<cloudhead> and then store that in the datatype?
<joelteon> list of Component
<joelteon> use that as the key
<joelteon> data Key = KeyA | KeyB | KeyC
<cloudhead> right right, cool
<cloudhead> ty
<cloudhead> what would be the benefits of a Components type?
<joelteon> component lookup would be the price of a pointer dereference instead of a hash and a lookup
<cloudhead> would just be type Components = HashMap ComponentType Component right?
<cloudhead> oh
<cloudhead> then I don't understand what you mean
<cloudhead> do you mean something like
<cloudhead> data Component = Component { A :: Int, B :: Int ... }
<cloudhead> wait no that's fucked
<joelteon> no
<joelteon> wait
<joelteon> oh
<joelteon> never mind
<joelteon> no
<joelteon> my mistake
<cloudhead> ok so I just go for hashmap
<cloudhead> thanks duder
<joelteon> you might want to benchmark it, because pattern matching items in a list might be faster
<cloudhead> ah I see ok
<cloudhead> yea the only issue is I may have dozens of component types
<cloudhead> might be annoying to have to match on all of them
<alexgordon> what're we talking about
<cloudhead> I'm prototyping my project in haskell to see if I can ditch rust
<cloudhead> needed some help
yorick has quit [Remote host closed the connection]