Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-27 15:32:46 <joel135> gaff: I may be wrong, but isn't this a Rank-N types issue?
2021-04-27 15:33:39 zmijunkie joins (~Adium@87.122.222.91)
2021-04-27 15:33:42 <gaff> joel135: i am not sure what you are saying.
2021-04-27 15:34:11 <joel135> let me see if i can solve it with that idea, hold on
2021-04-27 15:35:16 <gaff> basically, once the type is set in one case branch, the compiler doesn't allow another type annotation in a different branch of the case expression, although both branches return IO ().
2021-04-27 15:35:40 × zmijunkie1 quits (~Adium@109.90.32.89) (Ping timeout: 252 seconds)
2021-04-27 15:36:11 <ulidtko> indeed Rank-N types, I can't seem to solve it... "GHC doesn't yet support impredicative polymorphism"
2021-04-27 15:36:36 <gaff> ulidtko: what does it mean really?
2021-04-27 15:37:19 <ulidtko> gaff, would should be the type for this value? [(0,f),(1,h)]
2021-04-27 15:37:35 <ulidtko> it's a heterogeneous list, see
2021-04-27 15:38:04 <gaff> f and h have same type signatures
2021-04-27 15:38:09 nineonine joins (~nineonine@S0106a0ff7073d5d5.vf.shawcable.net)
2021-04-27 15:38:38 <ulidtko> you're right, but the compiler disagrees... hmmm
2021-04-27 15:38:57 × nineonine quits (~nineonine@S0106a0ff7073d5d5.vf.shawcable.net) (Remote host closed the connection)
2021-04-27 15:39:37 nineonine joins (~nineonine@2604:3d08:7785:9600:18c3:826f:bcf6:7789)
2021-04-27 15:39:40 <gaff> strange situation, really
2021-04-27 15:39:46 × nineonine quits (~nineonine@2604:3d08:7785:9600:18c3:826f:bcf6:7789) (Remote host closed the connection)
2021-04-27 15:40:00 nineonine joins (~nineonine@2604:3d08:7785:9600:8da3:57c2:b9e6:3845)
2021-04-27 15:40:02 <ulidtko> am indeed puzzled
2021-04-27 15:40:36 <joel135> Rank-N types here means that while f and h have the same type signatures, the type variable 'a' is instantiated at the point where f and h are used as input. That is, the function which accepts f and h does not get to choose a internally.
2021-04-27 15:41:04 <gaff> ulidtko: here is why the compiler disagrees. the compiler infers the type from the first branch, and then it says the second branch doesn't match.
2021-04-27 15:41:14 <joel135> ^
2021-04-27 15:41:30 <ulidtko> yea, some appropriately-placed forall's should get this working
2021-04-27 15:41:43 <joel135> yes i think so too
2021-04-27 15:42:35 <gaff> forall placed where? i am not sure ...
2021-04-27 15:44:02 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
2021-04-27 15:44:09 × ericsagn1 quits (~ericsagne@2405:6580:0:5100:d754:fcc4:a1d2:1fa1) (Ping timeout: 245 seconds)
2021-04-27 15:44:12 <gaff> ulidtko: i think it has something to do with this stuff being within mapM_?
2021-04-27 15:44:39 <joel135> i am getting "GHC doesn't yet support impredicative polymorphism" too now :(
2021-04-27 15:45:06 <ulidtko> yes the g and h must get packed into a single homogeneous list (implying same types)
2021-04-27 15:45:35 <gaff> i am using ghc 8.10.4. no such error for me.
2021-04-27 15:45:41 <joel135> (I tried this way of analysing the problem https://paste.tomsmeding.com/HNa0DhEb)
2021-04-27 15:46:44 × othe1 quits (~othe@195.140.213.38) (Remote host closed the connection)
2021-04-27 15:46:46 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-27 15:46:51 <joel135> related https://stackoverflow.com/questions/56448814/why-is-impredicative-polymorphism-allowed-only-for-functions-in-haskell
2021-04-27 15:47:04 × acidjnk_new2 quits (~acidjnk@p200300d0c72b9524d9e45372e00f3038.dip0.t-ipconnect.de) (Ping timeout: 245 seconds)
2021-04-27 15:48:08 <ulidtko> moving those to a top-level binding inputs = [(0, f), (1, h)] + NoMonomorphismRestriction moves to the next error
2021-04-27 15:48:09 <nicholasbulka> I can't seem to figure out how to get exhaustive patterns for this recursion definition:
2021-04-27 15:48:22 <nicholasbulka> spiral [] = []
2021-04-27 15:48:22 <nicholasbulka> spiral (x:xs) = x ++ spiral(reverse $ Lst.transpose (chunks (length xs) $ concat xs))
2021-04-27 15:48:30 <nicholasbulka> takes a [[Int]] -> [Int}
2021-04-27 15:48:32 × jgt quits (~jgt@78.162.43.217) (Ping timeout: 240 seconds)
2021-04-27 15:48:41 <c_wraith> joel135: note that the version of GHC currently in pre-release testing makes ImpredicativePolymorphism actually work better
2021-04-27 15:49:03 × nineonine quits (~nineonine@2604:3d08:7785:9600:8da3:57c2:b9e6:3845) (Remote host closed the connection)
2021-04-27 15:49:11 × landonf quits (landonf@mac68k.info) (Excess Flood)
2021-04-27 15:49:15 <joel135> i see, i am only using 8.8.4
2021-04-27 15:49:28 <gaff> joel135: i think what you are referrring to is another type of problem, where the forall is not placed outermost in the type signature.
2021-04-27 15:49:43 <joel135> isn't it the same problem?
2021-04-27 15:50:24 kiweun joins (~kiweun@2607:fea8:2a62:9600:85b6:a1c5:df8:4090)
2021-04-27 15:50:46 <nut> Is it feasible to create wrappers of the entire Lapack, Blas, gsl etc. with inline-c ? If so, we can create a Pandas-like lib in Haskell, wouldn't it be nice?
2021-04-27 15:50:56 landonf joins (landonf@mac68k.info)
2021-04-27 15:51:10 <gaff> no, as i understand it, f :: forall a. Ord a => [a] -> [a] is different from f :: [forall a. Ord a => a -> a]
2021-04-27 15:51:31 <ulidtko> it is different
2021-04-27 15:51:31 <joel135> yes that's true
2021-04-27 15:51:45 <geekosaur> nicholasbulka, what pattern does it claim isn't covered?
2021-04-27 15:51:50 <joel135> the stackoverflow link also says so, i see
2021-04-27 15:51:59 frozenErebus joins (~frozenEre@37.231.244.249)
2021-04-27 15:53:09 <nicholasbulka> where could I find that in ghci
2021-04-27 15:53:21 <nicholasbulka> I don't know is the short of it
2021-04-27 15:53:48 <geekosaur> if you are getting an inexhaustive patterns warning it should also say which patterns it thinks aren't included
2021-04-27 15:54:03 <geekosaur> oh, ghci
2021-04-27 15:54:20 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-27 15:54:20 <geekosaur> you need to put both definitions on the same line, separated by a semicolon
2021-04-27 15:54:34 <geekosaur> otherwise ghci doesn't know they go together
2021-04-27 15:54:45 <monochrom> In the long run you should use an editor, a filename, and :load
2021-04-27 15:54:59 × kiweun quits (~kiweun@2607:fea8:2a62:9600:85b6:a1c5:df8:4090) (Ping timeout: 245 seconds)
2021-04-27 15:55:12 <nicholasbulka> right
2021-04-27 15:55:13 <nicholasbulka> ok
2021-04-27 15:55:24 <ulidtko> or use the :{ :} multiline braces
2021-04-27 15:55:30 <monochrom> By the time you have 3 lines of code and after entering the 3rd line you realize you need to change the 1st line you've lost.
2021-04-27 15:55:46 <monochrom> This is why I refuse to bring up the :{ :} feature.
2021-04-27 15:56:00 <monochrom> It encourages the wrong habits.
2021-04-27 15:56:09 <joel135> ulidtko gaff: solved it https://paste.tomsmeding.com/qkTRpcFx
2021-04-27 15:56:10 <ulidtko> fair enough, it's a crappy workaround
2021-04-27 15:56:11 <monochrom> Entering your 100-line program at the prompt?
2021-04-27 15:56:17 <c_wraith> yeah, if you use semicolons you are still on the same line and can edit it. :P
2021-04-27 15:56:32 <c_wraith> and only 100? you're quitting so early!
2021-04-27 15:56:33 <ulidtko> joel135, ahhh yes. nice!
2021-04-27 15:56:48 <joel135> the stackoverflow link had the answer
2021-04-27 15:56:53 <monochrom> Do people enter shell scripts at the shell prompt just because they can?
2021-04-27 15:57:06 <c_wraith> sometimes, when it's appropriate
2021-04-27 15:57:11 ericsagn1 joins (~ericsagne@2405:6580:0:5100:7b81:a13d:7f4a:d3e9)
2021-04-27 15:57:20 <geekosaur> ^
2021-04-27 15:58:28 <ulidtko> joel135, so the trick is to make it clear where the dictionary packing & unpacking happens. instructive, TIL
2021-04-27 15:58:42 knupfer joins (~Thunderbi@200116b82b9c4f0069e2a2a836aa8e3f.dip.versatel-1u1.de)
2021-04-27 15:58:45 <nicholasbulka> that worked; thank you ;)
2021-04-27 15:58:58 <monochrom> Well, I am using the fuzzy divide that, e.g., when I enter a for-loop and the body is one short command, e.g., "for i in * ; do rm $i.c; done", it doesn't count as a script, it's just a long command.
2021-04-27 15:59:07 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 252 seconds)
2021-04-27 15:59:44 <gaff> joel135: it works ...
2021-04-27 16:00:10 ChrisMarquardt joins (~ChrisMarq@185.204.1.185)
2021-04-27 16:00:12 <joel135> You have to modularize your code, it's a feature! :-)
2021-04-27 16:00:21 <gaff> but i think there might be a cleaner way, though i am not sure
2021-04-27 16:00:26 × nut quits (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Remote host closed the connection)
2021-04-27 16:00:34 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-27 16:00:46 <DigitalKiwi> surely i'm not the only person who regularly writes 1 line bash scripts that end up being 15 after refactoring
2021-04-27 16:00:58 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-27 16:01:14 <geekosaur> no, but I also know how to use history to retrieve that line or so into a file to flesh it out
2021-04-27 16:01:23 <gaff> joel135: thanks much, by the way.
2021-04-27 16:01:33 <joel135> i learned as well :)
2021-04-27 16:01:40 <DigitalKiwi> yeah that's what i do

All times are in UTC.