guiyaz 2017-01-26 14:58:47
hello!
dmj` 2017-01-26 14:58:52
hi
guiyaz 2017-01-26 14:59:27
might I say that this is the nicest community I have seen.
fragamus 2017-01-26 15:16:22
ls :: Turtle.FilePath -> Shell Turtle.FilePath
fragamus 2017-01-26 15:17:52
I want to take the stream from ls and create a stream of lines for each Turtle.FilePath
fragamus 2017-01-26 15:18:23
so like convert one stream into another like pipes in linux
M0000 2017-01-26 15:18:33
I have a question here http://lpaste.net/351685
M0000 2017-01-26 15:19:14
question is kind of long, but gist is hiearichal data structures that have static components and also computed data that changes sometimes
M0000 2017-01-26 15:20:01
wanting to minimize needed arguments in functions, simplify things, application is music performance and on the whole it's pretty complicated so there's a real need to understand how to simplify
fragamus 2017-01-26 15:20:25
it seems like Turtle can do this
geekosaur 2017-01-26 15:21:32
fragamus, foldIO?
fragamus 2017-01-26 15:21:47
lemme see
Koterpillar 2017-01-26 15:22:08
M0000: why is alterTiming :: Note -> (Double, Double) and not Note -> ... -> Note?
M0000 2017-01-26 15:22:53
because I was thinking that Note contains static data, and (Double,Double) is computed data which at the beginning of the creation of the data doesn't exist
Koterpillar 2017-01-26 15:23:08
M0000: OK, so what does alterTiming alter?
Koterpillar 2017-01-26 15:23:22
M0000: you had a Note. Now you have two Doubles. What changed?
M0000 2017-01-26 15:23:23
if it is stored in Note, then I need to add two Double components, but they will be meaningless
M0000 2017-01-26 15:23:28
oh, yes,
M0000 2017-01-26 15:24:01
alterTiming may be bad name — basically a Note has a default timing computation, and alterTiming will create values to be added to that default computation
Koterpillar 2017-01-26 15:24:19
create values?
M0000 2017-01-26 15:24:24
but the default times may or may not be computed at the time alterTiming is called
Koterpillar 2017-01-26 15:24:39
M0000: do you want to produce a different Note, or not?
geekosaur 2017-01-26 15:24:41
fragamus, alternately I would guess that >>= binds a function Turtle.FilePath -> Turtle where is the file contents in your case, so you can just use liftIO readFile or something like that
M0000 2017-01-26 15:24:47
a Note represents a msucial concept that has a position in time expressed as a measure and beat
M0000 2017-01-26 15:25:08
but to make the note sound, this must be mapped to a time in seconds
geekosaur 2017-01-26 15:25:09
although see Turtle.Lines, it may need to be trickier than that
fragamus 2017-01-26 15:25:16
thanks geekosaur
Koterpillar 2017-01-26 15:25:27
M0000: what's an example value of Pitch?
Koterpillar 2017-01-26 15:25:32
M0000: what's an example value of Notehead?
M0000 2017-01-26 15:25:41
the Note doesn't change in the sense the musical concept doesn't change, but the attributes or means of playback may change
geekosaur 2017-01-26 15:25:42
er, liftIO . readFile
M0000 2017-01-26 15:25:54
type Pitch = Int, for the most part
Koterpillar 2017-01-26 15:26:01
M0000: and Notehead?
M0000 2017-01-26 15:26:07
data Notehead = Solid | Hollow | Diamon
Koterpillar 2017-01-26 15:26:10
okay
Koterpillar 2017-01-26 15:26:15
so Note 1 Solid is a Note?
M0000 2017-01-26 15:26:26
yes
Koterpillar 2017-01-26 15:26:36
M0000: what is the value of: alterTiming (Note 1 Solid)?
M0000 2017-01-26 15:27:00
let me back up, a musical score has notes which are grouped in chords which are grouped in voices which are grounped in staves
Koterpillar 2017-01-26 15:27:03
M0000: I suggest you re-read any Haskell books you were reading to get a better understanding at function syntax. For example...
Koterpillar 2017-01-26 15:27:08
:t negate
lambdabot 2017-01-26 15:27:09
Num a => a -> a
Koterpillar 2017-01-26 15:27:38
M0000: your alterTiming function takes a Note, which does _not_ have any time information in it, and somehow produces two Doubles
M0000 2017-01-26 15:27:46
to determine the timing of a Note requires knowing the Chord it's a part of, the Voice that is a part of, the Staff that is a part of, and the Score that is a part of
Koterpillar 2017-01-26 15:28:19
M0000: careful
M0000 2017-01-26 15:28:27
yes?
Koterpillar 2017-01-26 15:28:39
M0000: Chord [Note 1 Solid, Note 1 Solid, Note 1 Solid] sampleChordAttr
Koterpillar 2017-01-26 15:28:43
see how notes are all the same?
M0000 2017-01-26 15:28:50
Yes
M0000 2017-01-26 15:29:01
so Set Pitch?
Koterpillar 2017-01-26 15:29:02
so if your function takes this Chord and one of the Notes in it, it can't give me the timing
M0000 2017-01-26 15:29:24
because it can't uniquely identify the Note?
Koterpillar 2017-01-26 15:29:28
exactly
Koterpillar 2017-01-26 15:29:41
so for each of your containers, what you need to get the timing is not the _value_ of the item, but its index
M0000 2017-01-26 15:30:01
hmmm… well in a practical sense this data structure is created by reading MusicXML, which
M0000 2017-01-26 15:30:09
if sane, will never create that case
Koterpillar 2017-01-26 15:30:11
therefore, alterTiming :: StaffName -> VoiceNumber -> Pos -> Int -> (Double, Double)
geekosaur 2017-01-26 15:30:18
fragamus, in fact looking this over I think you want something like ls ... >>= readTextFile
M0000 2017-01-26 15:30:28
Koterpillar: yes
geekosaur 2017-01-26 15:30:45
or possibly <|> instead of >>
geekosaur 2017-01-26 15:30:59
*instead of >>=
M0000 2017-01-26 15:31:03
what I'm kind of asking is whether a Note should be defined as Note StaffName VoiceNumber Pos Int Pitch Notehead
M0000 2017-01-26 15:31:18
so one argument can be passed
M0000 2017-01-26 15:31:29
that creates a lot of redundant data, but in this application it's no matter
Koterpillar 2017-01-26 15:31:38
what other functions do you want on this?
Koterpillar 2017-01-26 15:31:44
M0000: you can encode this as some kind of Position { posSN :: StaffName, posVN :: VoiceNumber, posInChord :: Pos, ... }
Koterpillar 2017-01-26 15:31:48
and pass that argument around
M0000 2017-01-26 15:32:06
yeah that sounds good
Zemyla 2017-01-26 15:32:17
Is there an interesting, sub-Turing computational formalism with decidable equality between functions?
M0000 2017-01-26 15:32:43
I am not sure what I want .. by the way this application exists in an awkward form now, what I am realizing is that because it's experimental I am always changing it and I have created quite an unwieldy program
M0000 2017-01-26 15:33:27
I am even thinking of working more in GHCI and bringing some scripting-like features, because the need here is to try stuff quick and dirty
ertes 2017-01-26 15:34:10
Zemyla: define types 0 and 1 and type operators (+) and (*) to get the usual semiring of types, then disallow general recursion
ertes 2017-01-26 15:34:24
Zemyla: this basically constrains all types to be finite
Zemyla 2017-01-26 15:34:50
So you can compare two primitive recursive functions for equality?
ertes 2017-01-26 15:35:34
Zemyla: since the domain is finite, you can just compare the images
M0000 2017-01-26 15:35:35
so I might have data Value = ValInt Int | ValDoub Double | ValString String and set up some Map String Value structures in GHCI
M0000 2017-01-26 15:36:01
so I can't experimentally change how I'm doing or configuring things quick and dirty
M0000 2017-01-26 15:36:07
so I CAN
ertes 2017-01-26 15:36:39
Zemyla: not sure if this is useful though
ertes 2017-01-26 15:36:44
probably not
geekosaur 2017-01-26 15:37:46
@hackage universe
lambdabot 2017-01-26 15:37:47
http://hackage.haskell.org/package/universe
geekosaur 2017-01-26 15:38:41
at one point dmwit was showing off equality of functions (provided their domains and ranges were instances)
monochrom 2017-01-26 15:40:27
If f is a linear function (the linear algebra kind) with a finite-dimension domain, you only need to test f at finitely many samples. :)
fragamus 2017-01-26 15:44:45
fold (ls "hopper") Fold.head
fragamus 2017-01-26 15:44:45
:: MonadIO io => io (Maybe Turtle.FilePath)